{# Those macros deal with introduction and navigation for series pages. Using macros have been prefered over partial inclusion or inline code to make sure series_ordered_pages is forced to be used. A section's pages natural order is invalid in case of reversed pagination which would lead to invalid series' pages order. To prevent this, pages are ordered correctly in a separate variable which must be used instead of the series section pages. #} {# Computes the introduction of a series's page. Parameters: - `page`: The page object being part of the series. - `series_section`: The series' section the page belongs to. - `series_ordered_pages`: The series' pages properly ordered (see at the top of this file for an explanation). - `language_strings`: A dictionary containing the translation strings. #} {% macro get_introduction(page, series_section, series_ordered_pages, language_strings) %} {%- if "series" in series_section.extra and series_section.extra.series -%} {%- set allowed_series_page_introduction = ["none", "link", "summary", "custom"] -%} {%- set series_page_introduction = macros_settings::evaluate_setting_priority(setting="series_page_introduction", page=page, section=series_section, default_global_value="link") -%} {%- if series_page_introduction not in allowed_series_page_introduction -%} {{ throw(message="ERROR: Invalid value for series_page_description. Allowed values are 'none', 'link', 'summary' or 'custom' (defaults to 'link').") }} {%- endif -%} {# Prepare variables for substitution #} {%- set series_title = series_section.title -%} {%- set series_permalink = series_section.permalink -%} {%- set series_html_link = '' ~ series_section.title ~ '' -%} {%- set series_pages_list = [] -%} {%- set series_pages_number = 0 -%} {%- set series_page_index = 0 -%} {%- for series_page in series_ordered_pages -%} {%- set_global series_pages_number = series_pages_number + 1 -%} {%- if series_page.relative_path == page.relative_path -%} {%- set_global series_page_index = series_pages_number -%} {%- set series_pages_list_item = '
{{ series_page_headline | safe }}