{% macro content(page) %} {%- 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 #} {# {% set last_ancestor = page.ancestors | slice(start=-1) %} {% set current_section = get_section(path=last_ancestor.0) %} {% set settings_to_test = [ "footnote_backlinks", "katex", "quick_navigation_buttons", "show_reading_time", "show_remote_changes", "toc", ] %} {% 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) }}
#} {# End debugging #}
{{ page.title }}
{% if page.extra.tldr %}

TL;DR:

{{ page.extra.tldr }}

{% 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) }} {% endif %}
{# 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 #} {{ page.content | replace(from="", to=macros_toc::toc(page=page, header=false)) | safe }}
{# Check if comments are enabled #} {% set giscus_enabled = config.extra.giscus.enabled_for_all_posts or page.extra.giscus %} {% set utterances_enabled = config.extra.utterances.enabled_for_all_posts or page.extra.utterances %} {% set hyvortalk_enabled = config.extra.hyvortalk.enabled_for_all_posts or page.extra.hyvortalk %} {% set isso_enabled = config.extra.isso.enabled_for_all_posts or page.extra.isso %} {# Ensure only one comment system is enabled #} {# Counter for enabled comment systems #} {% set enabled_systems = 0 %} {# Check and count the enabled comment systems #} {% if giscus_enabled %} {% set comment_system = "giscus" %} {% set enabled_systems = enabled_systems + 1 %} {% endif %} {% if utterances_enabled %} {% set comment_system = "utterances" %} {% set enabled_systems = enabled_systems + 1 %} {% endif %} {% if hyvortalk_enabled %} {% set comment_system = "hyvortalk" %} {% set enabled_systems = enabled_systems + 1 %} {% endif %} {% if isso_enabled %} {% set comment_system = "isso" %} {% set enabled_systems = enabled_systems + 1 %} {% endif %} {# 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 %} {% set automatic_loading = config.extra[comment_system].automatic_loading %} {{ macros_add_comments::add_comments(comment_system=comment_system, automatic_loading=automatic_loading) }} {% endif %}
{# Quick navigation buttons #} {% if macros_settings::evaluate_setting_priority(setting="quick_navigation_buttons", page=page, default_global_value=false) == "true" %}
{# Button to go show a floating Table of Contents #} {% if page.toc %}
{{ macros_toc::toc(page=page, header=false) }}
{% endif %} {# Button to go to the comment section #} {% if comment_system %} {% endif %} {# Button to go to the top of the page #}
{% endif %} {# Add KaTeX functionality #} {%- if macros_settings::evaluate_setting_priority(setting="katex", page=page, default_global_value=false) == "true" -%} {%- endif -%} {# Add copy button to code blocks #} {%- if macros_settings::evaluate_setting_priority(setting="copy_button", page=page, default_global_value=true) == "true" -%} {%- endif -%} {# Add backlinks to footnotes #} {%- if macros_settings::evaluate_setting_priority(setting="footnote_backlinks", page=page, default_global_value=false) == "true" -%} {%- endif -%} {% endmacro content %}