{% extends "base.html" %}

{% block title %}{{page.title|safe}} &#8211; {{ tr.sitename|safe }}{% endblock title %}

{% block head %}
<meta property="og:title" content="{{page.title}}"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="{{page.permalink}}"/>
<meta property="og:locale" content="{{lang}}"/>
{% for t in page.translations %}
	{% if t.lang|default(value=config.default_language) != lang %}
		<meta property="og:locale:alternate" content="{{t.lang|default(value=config.default_language)}}"/>
	{% endif %}
{% endfor %}
<meta property="og:description" content="{{page.description}}"/>
<meta property="og:site_name" content="{{tr.sitename}}"/>
{% if page.extra.redirect %}
	<meta http-equiv="refresh" content="0;URL='{{page.extra.redirect}}'"/>
{% endif %}
{% if page.extra.katex %}{{macros::katex()}}{% endif %}
{% endblock head %}

{% block header %}
<span class="langs">
	{{lang}} &#8211;
	
	{% for t in page.translations %}
		{% if t.lang|default(value=config.default_language) != lang %}
			<a href="{{t.permalink|safe}}">{{t.lang|default(value=config.default_language)}}</a>
		{% endif %}
	{% endfor %}
</span>
{% endblock header %}

{% block main_begin %}
{% if page.toc %}
<nav class="sidenav">
	<ul class="toc">
		{% for h2 in page.toc %}
		<li>
			<a href="{{ h2.permalink | safe }}">{{ h2.title | safe }}</a>
			<ul>
				{% for h3 in h2.children %}
				<li><a href="{{ h3.permalink | safe }}">{{ h3.title | safe }}</a></li>
				{% endfor %}
			</ul>
		</li>
		{% endfor %}
	</ul>
</nav>
{% endif %}
{% endblock main_begin %}

{% block main %}
<h1>{{page.title | safe}}</h1>
<small class="article-date">{{page.date}}</small><br/>
<small class="article-tags">{% for tag in page.taxonomies.tags %}<a href="/{{macros::langurl()}}tags/{{tag}}">{{tag}}</a>{% if not loop.last %}, {% endif %}{% endfor %}</small>

{% if page.toc %}
<nav class="pagetoc">
	<ul class="toc">
		{% for h2 in page.toc %}
		<li>
			<a href="{{ h2.permalink | safe }}">{{ h2.title | safe }}</a>
			<ul>
				{% for h3 in h2.children %}
				<li><a href="{{ h3.permalink | safe }}">{{ h3.title | safe }}</a></li>
				{% endfor %}
			</ul>
		</li>
		{% endfor %}
	</ul>
</nav>
{% endif %}

{{page.content | safe}}

{% endblock main %}
