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.
115 lines
5.6 KiB
HTML
115 lines
5.6 KiB
HTML
{% macro content(page) %}
|
|
|
|
{% set separator = config.extra.separator | default(value="•") %}
|
|
|
|
<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>
|
|
{% if config.extra.remote_repository_url %}
|
|
<li> {{ separator }} <a href="{{ macros_create_history_url::create_history_url(relative_path=page.relative_path) }}" target="_blank" rel="noopener noreferrer">{%- 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">
|
|
{% if comment_system %}
|
|
<a href="#comments" id="comments-button">
|
|
<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 %}
|
|
|
|
<a href="#" id="top-button">
|
|
<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 %}
|