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.
141 lines
8.2 KiB
HTML
141 lines
8.2 KiB
HTML
{% 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 -%}
|
|
|
|
<main>
|
|
<article>
|
|
<div class="article-title">
|
|
{{ page.title }}
|
|
</div>
|
|
|
|
<ul class="meta">
|
|
{% if page.draft %}
|
|
<li class="draft-label">{%- if lang != config.default_language %} {{ trans(key="draft" | safe, lang=lang) }} {% else %} DRAFT {% endif %}</li>
|
|
{% endif %}
|
|
|
|
{% if page.date %}
|
|
<li>{{ macros_format_date::format_date(date=page.date, short=true) }} {{ separator }}</li>
|
|
{% endif %}
|
|
|
|
<li title="{{ page.word_count }} {%- if lang != config.default_language %} {{ trans(key="words" | safe, lang=lang) }} {% else %} words {% endif %}"> {{ page.reading_time }}{%- if lang != config.default_language %} {{ trans(key="min_read" | safe, lang=lang) }} {% else %} min read {% endif %}</li>
|
|
|
|
{% if page.taxonomies and page.taxonomies.tags %}
|
|
<li> {{ separator }} {%- if lang != config.default_language -%}{{ trans(key="tags" | safe, lang=lang) | capitalize }}{% else %}Tags{%- endif -%}: </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 %}
|
|
{% endif %}
|
|
|
|
{% if page.updated %}
|
|
</ul><ul class="meta last-updated"><li>{%- if lang != config.default_language %} {{ trans(key="last_updated_on" | safe, lang=lang) }} {% else %} Last updated on {% endif %} {{ macros_format_date::format_date(date=page.updated, short=true) }}</li>
|
|
{# Show link to remote changes if enabled #}
|
|
{% set show_remote_changes = config.extra.show_remote_changes | default(value=true) %}
|
|
{% if config.extra.remote_repository_url and show_remote_changes %}
|
|
<li> {{ separator }} <a href="{{ macros_create_history_url::create_history_url(relative_path=page.relative_path) }}" {{ blank_target }} rel="{{ rel_attributes }}">{%- if lang != config.default_language -%}{{ trans(key="see_changes" | safe, lang=lang) }}{% else %}See changes{%- endif -%}<small> ↗</small></a></li>
|
|
{% endif %}
|
|
{% endif %}
|
|
</ul>
|
|
|
|
{% if page.extra.tldr %}
|
|
<div class="tldr">
|
|
<h3>TL;DR:</h3>
|
|
<p>{{ page.extra.tldr }}</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{# Optional table of contents below the header #}
|
|
{% if page.extra.toc | default(value=false) and page.toc %}
|
|
{{ macros_toc::toc(page=page, header=true) }}
|
|
{% 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)) | safe }}
|
|
</section>
|
|
|
|
{# 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 %}
|
|
|
|
</article>
|
|
</main>
|
|
|
|
{% if config.extra.quick_navigation_buttons or page.extra.quick_navigation_buttons %}
|
|
<div id="button-container">
|
|
{# Button to go show a floating Table of Contents #}
|
|
{% if page.toc %}
|
|
<div id="toc-floating-container">
|
|
<input type="checkbox" id="toc-toggle" class="toggle"/>
|
|
<label for="toc-toggle" class="overlay"></label>
|
|
<label for="toc-toggle" id="toc-button" class="button" title="Toggle Table of Contents" aria-label="toggle Table of Contents">
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M414.82-193.094q-18.044 0-30.497-12.32-12.453-12.319-12.453-30.036t12.453-30.086q12.453-12.37 30.497-12.37h392.767q17.237 0 29.927 12.487 12.69 12.486 12.69 30.203 0 17.716-12.69 29.919t-29.927 12.203H414.82Zm0-244.833q-18.044 0-30.497-12.487Q371.87-462.9 371.87-480.45t12.453-29.92q12.453-12.369 30.497-12.369h392.767q17.237 0 29.927 12.511 12.69 12.512 12.69 29.845 0 17.716-12.69 30.086-12.69 12.37-29.927 12.37H414.82Zm0-245.167q-18.044 0-30.497-12.32t-12.453-30.037q0-17.716 12.453-30.086 12.453-12.369 30.497-12.369h392.767q17.237 0 29.927 12.486 12.69 12.487 12.69 30.203 0 17.717-12.69 29.92-12.69 12.203-29.927 12.203H414.82ZM189.379-156.681q-32.652 0-55.878-22.829t-23.226-55.731q0-32.549 23.15-55.647 23.151-23.097 55.95-23.097 32.799 0 55.313 23.484 22.515 23.484 22.515 56.246 0 32.212-22.861 54.893-22.861 22.681-54.963 22.681Zm0-245.167q-32.652 0-55.878-23.134-23.226-23.135-23.226-55.623 0-32.487 23.467-55.517t56.12-23.03q32.102 0 54.721 23.288 22.62 23.288 22.62 55.775 0 32.488-22.861 55.364-22.861 22.877-54.963 22.877Zm-.82-244.833q-32.224 0-55.254-23.288-23.03-23.289-23.03-55.623 0-32.333 23.271-55.364 23.272-23.03 55.495-23.03 32.224 0 55.193 23.288 22.969 23.289 22.969 55.622 0 32.334-23.21 55.364-23.21 23.031-55.434 23.031Z"/></svg>
|
|
</label>
|
|
<div class="toc-content">
|
|
{{ macros_toc::toc(page=page, header=false) }}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{# Button to go to the comment section #}
|
|
{% if comment_system %}
|
|
<a href="#comments" id="comments-button" title="Go to comment section">
|
|
<svg viewBox="0 0 20 20" fill="currentColor"><path d="M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z" clip-rule="evenodd" fill-rule="evenodd"/></svg>
|
|
</a>
|
|
{% endif %}
|
|
|
|
{# Button to go to the top of the page #}
|
|
<a href="#" id="top-button" title="Go to top of page">
|
|
<svg viewBox="0 0 20 20" fill="currentColor"><path d="M3.293 9.707a1 1 0 010-1.414l6-6a1 1 0 011.414 0l6 6a1 1 0 01-1.414 1.414L11 5.414V17a1 1 0 11-2 0V5.414L4.707 9.707a1 1 0 01-1.414 0z"/></svg>
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% endmacro content %}
|