{% extends "base.html" %} {% block main_content %} {%- set separator = config.extra.separator | default(value="•") -%} {%- set rel_attributes = macros_rel_attributes::rel_attributes() | trim -%} {%- if config.markdown.external_links_target_blank -%} {%- set blank_target = "target=_blank" -%} {%- else -%} {%- set blank_target = "" -%} {%- endif -%} {# Debugging #} {#
    Page path: {{ page.path }}
    Page components: {{ page.components | join(sep=", ") }}
    Page ancestors: {{ page.ancestors | join(sep=", ") }}
    Current language: {{ lang }}
    Default language: {{ config.default_language }}
    Current section: {% if current_section %}{{ current_section.path }}{% else %}None{% endif %}
    Page extra: {{ page.extra | json_encode() }}
    {% if section -%}
        {%- set current_section = section -%}
    {%- elif page -%}
        {%- set current_section = "" -%}
        {%- if page.ancestors | length > 0 -%}
            {%- set last_ancestor = page.ancestors | slice(start=-1) -%}
            {%- set_global current_section = get_section(path=last_ancestor.0, metadata_only=true) -%}
        {%- else -%}
            {%- set components = page.components -%}
            {%- for i in range(start=1, end=components | length) -%}
                {%- if lang == config.default_language -%}
                    {%- set potential_path = components | slice(end=components | length - i) | join(sep="/") -%}
                    {%- set potential_page = potential_path ~ "/index.md" -%}
                    {%- set potential_section = potential_path ~ "/_index.md" -%}
                {%- else -%}
                    {%- set potential_path = components | slice(start=1, end=components | length - i) | join(sep="/") -%}
                    {%- set potential_page = potential_path ~ "/index." ~ lang ~ ".md" -%}
                    {%- set potential_section = potential_path ~ "/_index." ~ lang ~ ".md" -%}
                {%- endif -%}
                Checking parent page: {{ potential_page }}
                {%- set page_data = load_data(path=potential_page, required=false) -%}
                {%- if page_data -%}
                    {%- set_global current_section = get_page(path=potential_page) %}
    Parent page found: {{ current_section.path }}
                    {%- break -%}
                {%- endif -%}
                Checking section: {{ potential_section }}
                {%- set section_data = load_data(path=potential_section, required=false) -%}
                {%- if section_data -%}
                    {%- set_global current_section = get_section(path=potential_section, metadata_only=true) -%}
                    Section found: {{ current_section.path }}
                    {%- break -%}
                {%- endif -%}
            {%- endfor -%}
        {%- endif -%}
    {%- endif %}
Found nearest parent/section: {% if current_section %}{{ current_section.path }}{% else %}None{% endif %}
Current section extra: {% if current_section %}{{ current_section.extra | json_encode() }}{% else %}None{% endif %}
{% set settings_to_test = [ "footnote_backlinks", "add_src_to_code_block", "force_codeblock_ltr", "copy_button", "katex", "quick_navigation_buttons", "show_reading_time", "show_date", "show_author", "show_remote_changes", "toc", "show_previous_next_article_links", "invert_previous_next_article_links", "previous_next_article_links_full_width", "enable_csp", ] %} {% for setting in settings_to_test %} {% endfor %}
setting page section config macro output
{{ setting }} {{ page.extra[setting] | default(value="⬛") }} {{ current_section.extra[setting] | default(value="⬛") }} {{ config.extra[setting] | default(value="⬛") }} {{ macros_settings::evaluate_setting_priority(setting=setting, page=page) }}
#} {# {{ __tera_context }} #} {# End debugging #}

{{ page.title }}

{#- A page is part of a series if one of the sections above (whether it is transparent or not) has the `extra.series` parameter set to true. -#} {#- As a series might be a transparent section in order to mix up its articles with those of the section just above or the root, -#} {#- there is no other way but to compute the potential path of each ancestor section related to the page and look for the first one being a series. -#} {#- Using the `ancestors` field of a section is not possible because transparent sections are not present in this field. -#} {%- set current_path = [] -%} {%- set section_paths = [] -%} {%- for path in page.relative_path | split(pat="/") | slice(end=-1) -%} {%- set_global current_path = current_path | concat(with=path) -%} {%- set section_path = current_path | concat(with="_index.md") | join(sep="/") -%} {%- set_global section_paths = section_paths | concat(with=section_path) -%} {%- endfor -%} {#- The series the page is part of is the closest section flagged as a series, if any -#} {%- for section_path in section_paths | reverse -%} {%- set section_file_exists = load_data(path=section_path, required=false) -%} {%- if section_file_exists -%} {%- set loaded_section = get_section(path=section_path,lang=lang) -%} {%- if "series" in loaded_section.extra and loaded_section.extra.series -%} {%- set_global series_section = loaded_section -%} {%- set_global series_ordered_pages = loaded_section.pages -%} {%- if loaded_section.paginated | default(value=0) > 0 and loaded_section.paginate_reversed -%} {%- set_global series_ordered_pages = loaded_section.pages | reverse -%} {%- endif -%} {%- break -%} {%- endif -%} {%- endif -%} {%- endfor -%} {% if page.extra.tldr %}
TL;DR

{{ page.extra.tldr | markdown | safe }}

{% endif %} {#- Optional table of contents below the header -#} {% if page.toc and macros_settings::evaluate_setting_priority(setting="toc", page=page, default_global_value=false) == "true" %} {{ macros_toc::toc(page=page, header=true, language_strings=language_strings) }} {% endif %}
{#- Replace series_intro placeholder -#} {%- set content_with_intro = page.content -%} {%- if "" in page.content -%} {%- set series_intro_html = macros_series_page::get_introduction(page=page, series_section=series_section, series_ordered_pages=series_ordered_pages, language_strings=language_strings) -%} {%- set content_with_intro = content_with_intro | replace(from="", to=series_intro_html) -%} {%- elif series_section -%} {%- set series_intro_html = macros_series_page::get_introduction(page=page, series_section=series_section, series_ordered_pages=series_ordered_pages, language_strings=language_strings) -%} {%- set content_with_intro = series_intro_html ~ content_with_intro -%} {%- endif -%} {#- Handle series_outro placeholder -#} {%- set processed_content = content_with_intro -%} {%- if "" in content_with_intro -%} {%- set series_outro_html = macros_series_page::get_outro(page=page, series_section=series_section, series_ordered_pages=series_ordered_pages, language_strings=language_strings) -%} {%- set processed_content = processed_content | replace(from="", to=series_outro_html) -%} {%- elif series_section -%} {%- set series_outro_html = macros_series_page::get_outro(page=page, series_section=series_section, series_ordered_pages=series_ordered_pages, language_strings=language_strings) -%} {#- We want the outro at the end of the article, but before footnote definitions -#} {%- set footnotes_marker = '
    ' -%} {%- if footnotes_marker in content_with_intro -%} {%- set content_sections = processed_content | split(pat=footnotes_marker) -%} {%- set main_content = content_sections | first -%} {%- set footnotes_content = content_sections | slice(start=1) | join(sep=footnotes_marker) -%} {%- set processed_content = main_content ~ series_outro_html ~ footnotes_marker ~ footnotes_content -%} {%- else -%} {%- set processed_content = processed_content ~ series_outro_html -%} {%- endif -%} {%- endif -%} {#- Replace TOC and render final content -#} {#- The replace pattern is used to enable arbitrary locations for the Table of Contents -#} {#- This is Philipp Oppermann's workaround: https://github.com/getzola/zola/issues/584#issuecomment-474329637 -#} {{ processed_content | replace(from="", to=macros_toc::toc(page=page, header=false, language_strings=language_strings)) | safe }}
{#- Check if comments are enabled, checking that they are not disabled on the specific page -#} {% set systems = ["giscus", "utterances", "hyvortalk", "isso"] %} {% set enabled_systems = 0 %} {% set comment_system = "" %} {% for system in systems %} {% set global_enabled = config.extra[system].enabled_for_all_posts | default(value=false) %} {% set page_enabled = page.extra[system] | default(value=global_enabled) %} {% set is_enabled = global_enabled and page_enabled != false or page_enabled == true %} {% if is_enabled %} {% set_global comment_system = system %} {% set_global enabled_systems = enabled_systems + 1 %} {% endif %} {% endfor %} {% if macros_settings::evaluate_setting_priority(setting="show_previous_next_article_links", page=page, default_global_value=true) == "true" %} {%- if page.lower or page.higher -%} {% set next_label = macros_translate::translate(key="next", default="Next", language_strings=language_strings) %} {% set prev_label = macros_translate::translate(key="prev", default="Prev", language_strings=language_strings) %} {% if macros_settings::evaluate_setting_priority(setting="invert_previous_next_article_links", page=page, default_global_value=true) == "true" %} {% if page.higher %} {% set left_link = page.higher.permalink %} {% set left_label = prev_label %} {% set left_title = page.higher.title %} {% endif %} {% if page.lower %} {% set right_link = page.lower.permalink %} {% set right_label = next_label %} {% set right_title = page.lower.title %} {% endif %} {% else %} {% if page.lower %} {% set left_link = page.lower.permalink %} {% set left_label = next_label %} {% set left_title = page.lower.title %} {% endif %} {% if page.higher %} {% set right_link = page.higher.permalink %} {% set right_label = prev_label %} {% set right_title = page.higher.title %} {% endif %} {% endif %} {% if macros_settings::evaluate_setting_priority(setting="previous_next_article_links_full_width", page=page, default_global_value=true) == "true" %} {%- set full_width_class = "full-width" -%} {% endif %} {%- endif -%} {%- endif -%} {#- Comments -#} {#- Ensure only one comment system is enabled -#} {% if enabled_systems > 1 %} {{ throw(message="ERROR: Multiple comment systems have been enabled for the same page. Check your config.toml and individual page settings to ensure only one comment system is activated at a time.") }} {% endif %} {% if comment_system %} {% include "partials/comments.html" %} {% endif %}
{%- include "partials/extra_features.html" -%} {% endblock main_content %}