{% extends "base.html" %}

{% block content %}
<div><a href="..">..</a>/<span class="accent-data">{{ page.slug }}</span></div>
{% set lang = page.extra.lang | default (value=page.lang) %}
{% if lang == "fr" %}
  {% set date_locale = "fr_FR" %}
{% else %}
  {% set date_locale = "en_GB" %}
{% endif  %}
<time datetime="{{ page.date }}">{{ trans(key="published-on", lang=lang) }} <span class="accent-data">{{ page.date | date(format="%d %B %Y", locale=date_locale) }}</span></time>
{% if page.authors %}
<address rel="author">{{ trans(key="published-by", lang=lang) }} <span class="accent-data">
  {% if page.authors | length > 0 %}
    {% for author in page.authors %}
      {% if loop.last %}
        {{ author }}
      {% else %}
        {{ author ~ ", " }}
      {% endif %}
    {% endfor %}
  {% endif %}
</span></address>
{% elif config.extra.author and config.extra.display_author == true %}
  <address rel="author">{{ trans(key="published-by", lang=lang) }} <span class="accent-data">{{config.extra.author}}</span></address>
{% endif %}
{% if page.extra.license %}
  <div>{{ trans(key="license", lang=lang) }} {{page.extra.license | safe}}</div>
{% endif %}

<h1>{{ page.title }}</h1>

{% if page.toc and 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>
        <ul>
          {% for h3 in h2.children %}
          <li>
            <a href="{{ h3.permalink | safe }}">{{ h3.title }}</a>
          </li>
          {% endfor %}
        </ul>
      </li>
      {% endfor %}
    </ul>
    {% endif %}
  </li>
  {% endfor %}
</ul>
{% endif %}

{{ page.content | safe }}

<p class="tags-data">
  {% if page.taxonomies.tags %}
  {% for tag in page.taxonomies.tags %}
  <a href="/tags/{{ tag | slugify }}">&#47;{{ tag }}&#47;</a>
  {% endfor %}
  {% endif %}
</p>
{% endblock content %}