Add support for series

This commit is contained in:
Jesse Braham 2025-02-16 16:37:39 +01:00
parent 030b0d3767
commit aa88d6f909
5 changed files with 73 additions and 1 deletions

View File

@ -77,7 +77,7 @@ THEME = "theme"
MENUITEMS = [
("posts", ""),
("projects", "projects.html"),
("series", "series.html"),
("about", "about.html"),
]

View File

@ -5,6 +5,7 @@ livereload==2.7.1
Markdown==3.7
pelican==4.11.0
pelican-neighbors==1.2.0
pelican-series==3.0.0
pelican-sitemap==1.2.0
pelican-statistics==1.0.0
pelican-webassets==2.1.0

View File

@ -200,6 +200,30 @@ footer {
@apply font-mono text-lg text-zinc-400;
}
.article-series {
@apply italic my-8;
.series-name {
@apply font-bold;
}
ol {
@apply list-decimal list-inside;
li {
@apply not-italic;
&::marker {
@apply font-mono;
}
span {
@apply text-zinc-400;
}
}
}
}
article {
@apply font-light mt-8 text-lg;

View File

@ -38,6 +38,23 @@
</div>
<article role="article">
{% if article.series %}
<div class="article-series">
<p>This article is part {{ article.series.index }} of the <span class="series-name">{{ article.series.name }}</span> series:</p>
<ol>
{% for part_article in article.series.all %}
<li>
{% if part_article == article %}
<span>{{ part_article.title }}</span>
{% else %}
<a href="{{ SITEURL }}/{{ part_article.url }}">{{ part_article.title }}</a>
{% endif %}
</li>
{% endfor %}
</ol>
</div>
{% endif %}
{{ article.content }}
</article>

View File

@ -0,0 +1,30 @@
{% extends "partials/_base.html" %}
{# Page title: #}
{% block title %}{{ page.title|lower }} {{ SITENAME|lower }}{% endblock %}
{# Page metadata: #}
{% block meta %}
<meta name="description" content="" />
<link rel="canonical" href="{{ SITEURL }}/{{ page.url }}" />
{% endblock %}
{# Page content: #}
{% block content %}
<h1>{{ page.title }}</h1>
{% for series_name, series_articles in article_series|items %}
<h2>{{ series_name }}</h2>
<ul class="post-list">
{% for article in series_articles|sort(attribute="locale_date") %}
<li class="flex-col md:flex-row mb-4 md:mb-2">
<span class="date text-base md:text-lg">{{ article.locale_date }}</span>
<span class="title">
<a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a>
</span>
</li>
{% endfor %}
</ul>
{% endfor %}
{% endblock content %}