You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
284 lines
15 KiB
HTML
284 lines
15 KiB
HTML
{% 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 #}
|
|
{# <div><pre>
|
|
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 %}
|
|
</pre></div>
|
|
|
|
{% set settings_to_test = [
|
|
"footnote_backlinks",
|
|
"add_src_to_code_block",
|
|
"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",
|
|
] %}
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>setting</th>
|
|
<th>page</th>
|
|
<th>section</th>
|
|
<th>config</th>
|
|
<th>macro output</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for setting in settings_to_test %}
|
|
<tr>
|
|
<td><code>{{ setting }}</code></td>
|
|
<td>{{ page.extra[setting] | default(value="⬛") }}</td>
|
|
<td>{{ current_section.extra[setting] | default(value="⬛") }}</td>
|
|
<td>{{ config.extra[setting] | default(value="⬛") }}</td>
|
|
<td>{{ macros_settings::evaluate_setting_priority(setting=setting, page=page) }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div> #}
|
|
{# {{ __tera_context }} #}
|
|
{# End debugging #}
|
|
|
|
<main>
|
|
<article>
|
|
<h1 class="article-title">
|
|
{{ page.title }}
|
|
</h1>
|
|
|
|
<ul class="meta">
|
|
{#- Draft indicator -#}
|
|
{% if page.draft %}
|
|
<li class="draft-label">{{ macros_translate::translate(key="draft", default="DRAFT", language_strings=language_strings) }}</li>
|
|
{% endif %}
|
|
|
|
{#- Author(s) -#}
|
|
{% if page.authors or config.author and macros_settings::evaluate_setting_priority(setting="show_author", page=page, default_global_value=false) == "true" %}
|
|
{%- if page.authors -%}
|
|
{%- set author_list = page.authors -%}
|
|
{%- else -%}
|
|
{%- set author_list = [config.author] -%}
|
|
{%- endif -%}
|
|
|
|
{%- if author_list | length == 1 -%}
|
|
{%- set author_string = author_list.0 -%}
|
|
{%- else -%}
|
|
{%- set last_author = author_list | last -%}
|
|
{%- set other_authors = author_list | slice(end=-1) -%}
|
|
{%- set author_separator = macros_translate::translate(key="author_separator", default=", ", language_strings=language_strings) -%}
|
|
{%- set conjunction = macros_translate::translate(key="author_conjunction", default=" and ", language_strings=language_strings) -%}
|
|
{%- set author_string = other_authors | join(sep=author_separator) -%}
|
|
{%- set author_string = author_string ~ conjunction ~ last_author -%}
|
|
{%- endif -%}
|
|
|
|
{%- set by_author = macros_translate::translate(key="by_author", default="By $AUTHOR", language_strings=language_strings) -%}
|
|
<li>{{ by_author | replace(from="$AUTHOR", to=author_string) }}</li>
|
|
{%- set previous_visible = true -%}
|
|
{% endif %}
|
|
|
|
{#- Date -#}
|
|
{% if page.date and macros_settings::evaluate_setting_priority(setting="show_date", page=page, default_global_value=true) == "true" %}
|
|
{%- if previous_visible -%} {{ separator }} {%- endif -%}<li>{{ macros_format_date::format_date(date=page.date, short=true, language_strings=language_strings) }}</li>
|
|
{#- Variable to keep track of whether we've shown a section, to avoid separators as the first element -#}
|
|
{%- set previous_visible = true -%}
|
|
{% endif %}
|
|
|
|
{#- Reading time -#}
|
|
{% if macros_settings::evaluate_setting_priority(setting="show_reading_time", page=page, default_global_value=true) == "true" %}
|
|
{%- if previous_visible -%} {{ separator }} {%- endif -%}<li title="{{ macros_translate::translate(key="words", number=page.word_count, default="$NUMBER words", language_strings=language_strings) }}">{{ macros_translate::translate(key="min_read", number=page.reading_time, default="$NUMBER min read", language_strings=language_strings) }}</li>
|
|
{%- set previous_visible = true -%}
|
|
{% endif %}
|
|
|
|
{#- Tags -#}
|
|
{%- if page.taxonomies and page.taxonomies.tags -%}
|
|
{%- if previous_visible -%} {{ separator }} {%- endif -%}<li>{{- macros_translate::translate(key="tags", default="tags", language_strings=language_strings) | capitalize -}}: </li>
|
|
{%- for tag in page.taxonomies.tags -%}
|
|
<li><a href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}">{{ tag }}</a>
|
|
{%- if not loop.last -%}
|
|
,
|
|
{%- endif -%}
|
|
</li>
|
|
{%- endfor -%}
|
|
{%- set previous_visible = true -%}
|
|
{%- endif -%}
|
|
|
|
{#- Last updated on -#}
|
|
{% if page.updated %}
|
|
{%- set last_updated_str = macros_translate::translate(key="last_updated_on", default="Updated on $DATE", language_strings=language_strings) -%}
|
|
{%- set formatted_date = macros_format_date::format_date(date=page.updated, short=true, language_strings=language_strings) -%}
|
|
{%- set updated_str = last_updated_str | replace(from="$DATE", to=formatted_date) -%}
|
|
</ul><ul class="meta last-updated"><li>{{ updated_str }}</li>
|
|
{# Show link to remote changes if enabled #}
|
|
{% if config.extra.remote_repository_url and macros_settings::evaluate_setting_priority(setting="show_remote_changes", page=page, default_global_value=true) == "true" %}
|
|
{%- if previous_visible -%}{{ separator }} {%- endif -%}
|
|
<li><a href="{% include "partials/history_url.html" %}" {{ blank_target }} rel="{{ rel_attributes }}">{{ macros_translate::translate(key="see_changes", default="See changes", language_strings=language_strings) }}<small> <span class="arrow-corner">↗</span></small></a></li>
|
|
{% endif %}
|
|
{% endif %}
|
|
</ul>
|
|
|
|
{% if page.extra.tldr %}
|
|
<div class="admonition note">
|
|
<div class="admonition-icon admonition-icon-note"></div>
|
|
<div class="admonition-content">
|
|
<strong class="admonition-title">
|
|
<span title="Too long; didn't read (summary)">TL;DR</span>
|
|
</strong>
|
|
<p>{{ page.extra.tldr | markdown | safe }}</p>
|
|
</div>
|
|
</div>
|
|
{% 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 %}
|
|
|
|
<section class="body">
|
|
{# 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="<!-- toc -->", to=macros_toc::toc(page=page, header=false, language_strings=language_strings)) | safe }}
|
|
</section>
|
|
|
|
{# 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 %}
|
|
|
|
{# 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 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 %}
|
|
<nav class="{{ full_width_class | default(value="") }} article-navigation">
|
|
<div>
|
|
{%- if left_link and left_label and left_title -%}
|
|
<a href="{{ left_link | safe }}" aria-label="{{ left_label }}" aria-describedby="left_title"><span class="arrow">←</span> {{ left_label }}</a>
|
|
<p aria-hidden="true" id="left_title">{{ left_title | truncate(length=100, end="…") }}</p>
|
|
{%- endif -%}
|
|
</div>
|
|
<div>
|
|
{%- if right_link and right_label and right_title -%}
|
|
<a href="{{ right_link | safe }}" aria-label="{{ right_label }}" aria-describedby="right_title">{{ right_label }} <span class="arrow">→</span></a>
|
|
<p aria-hidden="true" id="right_title">{{ right_title | truncate(length=100, end="…") }}</p>
|
|
{%- endif -%}
|
|
</div>
|
|
</nav>
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
|
|
{# Comments #}
|
|
{% if comment_system %}
|
|
{% include "partials/comments.html" %}
|
|
{% endif %}
|
|
|
|
</article>
|
|
</main>
|
|
|
|
{%- include "partials/extra_features.html" -%}
|
|
|
|
{% endblock main_content %}
|