{% extends "base.html" %}

{% block content %}
<article>
	<h1>{{ page.title }}</h1>

	{%- if page.date %}
		<small>
			<time datetime="{{ page.date | date(format=' %+') }}" pubdate>
				{{- page.date | date(format=config.extra.date_format) -}}
			</time>
			{%- if page.authors %}
				<span>•</span>
				<span>{{ trans(key="author", lang=lang) }}: {{ page.authors[0] }}</span>
			{%- endif %}
			{%- if page.taxonomies %}
				{%- for name, taxon in page.taxonomies %}
					<span>•</span>
					<ul class="tags">
						{%-for item in taxon %}
							<li>
								<a class="tag" href="{{ get_taxonomy_url(kind=name, name=item, lang=lang) }}">{{ item }}</a>
							</li>
						{%- endfor %}
					</ul>
				{%- endfor %}
			{%- endif %}
		</small>
	{%- endif %}

	{% if page.extra.archive %}
		<div class="statement-container archive">
			<strong class="big">
				<i class="icon"></i>
				{{ trans(key="archived", lang=lang) }}
			</strong>
			{{ page.extra.archive | markdown | safe }}
		</div>
	{% endif %}

	{% if page.extra.trigger %}
		<div class="statement-container trigger">
			<strong class="big">
				<i class="icon"></i>
				{{ trans(key="trigger_warning", lang=lang) }}
			</strong>
			{{ page.extra.trigger | markdown | safe }}
		</div>
	{% endif %}

	{% if page.extra.disclaimer %}
		<div class="statement-container disclaimer">
			<strong class="big">
				<i class="icon"></i>
				{{ trans(key="disclaimer", lang=lang) }}
			</strong>
			{{ page.extra.disclaimer | markdown | safe }}
		</div>
	{% endif %}

	{% if page.extra.toc %}
		<h2>{{ trans(key="table_of_contents", lang=lang) }}</h2>
		<ul>
			{% for h1 in page.toc %}
				<li>
					<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
					{% if h1.children %}
						<ul>
							{% for h2 in h1.children %}
								<li>
									<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
								</li>
							{% endfor %}
						</ul>
					{% endif %}
				</li>
			{% endfor %}
		</ul>
	{% endif %}

	{{ page.content | safe }}
</article>

{% if page.extra.comments.id %}
	{% include "partials/comments.html" ignore missing %}
{% endif %}

{% if page.lower or page.higher %}
	<hr>
	<nav id="post-nav">
		{% if page.higher %}
			<a class="post-nav-item post-nav-prev" href="{{ page.higher.permalink }}">
				<div class="nav-arrow">← {{ trans(key="page_previous", lang=lang) }}</div>
				<span class="post-title">{{ page.higher.title }}</span>
			</a>
		{% endif %}
		{% if page.lower %}
			<a class="post-nav-item post-nav-next" href="{{ page.lower.permalink }}">
				<div class="nav-arrow">{{ trans(key="page_next", lang=lang) }} →</div>
				<span class="post-title">{{ page.lower.title }}</span>
			</a>
		{% endif %}
	</nav>
{% endif %}

<div class="dialog-buttons">
	<a class="inline-button" href="#top">{{ trans(key="go_to_top", lang=lang) }}</a>
	{% if config.extra.issues_url %}
		<a class="inline-button colored" href="{{ config.extra.issues_url }}">{{ trans(key="file_an_issue", lang=lang) }}</a>
	{% endif %}
</div>
{% endblock content %}
