feat(series): add a page to display a series

It displays an explanation of the series and lists all its articles.
This commit is contained in:
ZzMzaw 2024-08-07 07:59:38 +02:00
parent 080a1b4b8c
commit 45705ed9c6
8 changed files with 138 additions and 21 deletions

55
templates/series.html Normal file
View file

@ -0,0 +1,55 @@
{% extends "base.html" %}
{% block main_content %}
{# Throw an error if the section is not flagged as a series. #}
{# This page would be displayed properly but it would become impossible for the series' child pages to reference their series. #}
{%- if "series" not in section.extra or not section.extra.series -%}
{{ throw(message="Section is not flagged as a series. Set `section.extra.series` to `true` if you want to use `series.html` template.") }}
{%- endif -%}
<main>
{%- if section.extra.header %}
{%- include "partials/home_banner.html" -%}
{% endif -%}
<article>
<div>
<span class="title-label">{{ macros_translate::translate(key="series", default="SERIES", language_strings=language_strings) }}</span>
{%- set jump_to_series_posts = macros_translate::translate(key="series_jump_to_posts", default="Jump to posts", language_strings=language_strings) -%}
<a href="#posts-list" class="title-button no-hover-padding" title="{{ jump_to_series_posts }}">
{{ jump_to_series_posts }}
</a>
{{ macros_page_header::page_header(title=section.title) }}
</div>
<section class="body">
{{ section.content | safe }}
</section>
</article>
<div id="posts-list">
<div>
<h2 class="seriesposts-title bottom-divider">
{{ macros_translate::translate(key="series_posts", default="Series' posts:", language_strings=language_strings) }}
</h2>
</div>
{%- if paginator %}
{%- set pages = paginator.pages -%}
{% else %}
{%- set pages = section.pages -%}
{% endif -%}
{% set max_posts = section.extra.max_posts | default(value=999999) %}
{{ macros_list_posts::list_posts(posts=pages, max=max_posts, metadata="indexes", language_strings=language_strings, section_path=section.path, paginator=paginator | default(value="")) }}
</div>
{% if paginator %}
{%- include "partials/paginate.html" -%}
{% endif %}
</main>
{%- include "partials/extra_features.html" -%}
{% endblock main_content %}