blog/templates/page.html
2026-02-09 12:30:49 +01:00

49 lines
2.2 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ page.title }} - {{ config.title }}{% endblock title %}
{% block description %}{% if page.description %}{{ page.description }}{% else %}{{ config.description }}{% endif %}{% endblock description %}
{% block canonical %}{{ page.permalink }}{% endblock canonical %}
{% block og_title %}{{ page.title }}{% endblock og_title %}
{% block og_description %}{% if page.description %}{{ page.description }}{% else %}{{ config.description }}{% endif %}{% endblock og_description %}
{% block og_url %}{{ page.permalink }}{% endblock og_url %}
{% block og_type %}article{% endblock og_type %}
{% block og_extra %}{% if page.date %}<meta property="article:published_time" content="{{ page.date }}">{% endif %}{% endblock og_extra %}
{% block twitter_title %}{{ page.title }}{% endblock twitter_title %}
{% block twitter_description %}{% if page.description %}{{ page.description }}{% else %}{{ config.description }}{% endif %}{% endblock twitter_description %}
{% block content %}
<article>
<header class="post-header">
<h1>{{ page.title }}</h1>
{% if page.date %}<time datetime="{{ page.date }}">{{ page.date | date(format="%B %d, %Y") }}</time>{% endif %}
</header>
<div class="content">
{% if page.content is containing("<!--TOC_PLACEHOLDER-->") %}
{% set parts = page.content | split(pat="<!--TOC_PLACEHOLDER-->") %}
{{ parts[0] | safe }}
<nav class="toc">
<p class="toc-title">Table of Contents</p>
<ul>
{% for h2 in page.toc %}
<li>
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
{% if h2.children %}
<ul>
{% for h3 in h2.children %}
<li><a href="{{ h3.permalink | safe }}">{{ h3.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
{{ parts[1] | safe }}
{% else %}
{{ page.content | safe }}
{% endif %}
</div>
</article>
{% endblock content %}