{% extends "base.html" %}

{% block title %}{{ article.title }}{% endblock title %}
{% block crumb %}blog/{{ article.slug }}{% endblock crumb %}

{% block content %}
{% if logged_in_admin %}
<header class="term-cmd">
  <div>
    <h1 class="term-title">{{ article.title }}</h1>
    <p class="term-sub">// {{ article.view_count }} {{ t(key="blog-views", lang=lang | default(value='sk')) }}</p>
  </div>
  <div class="term-cmd-actions">
    <a href="/blog" class="btn btn-outline btn-sm">[ {{ t(key="cd-up", lang=lang | default(value='sk')) }} ]</a>
  </div>
</header>

<article class="card">
  <div class="term-head">
    <span class="term-head-name">~/blog/{{ article.slug }}.txt</span>
    <span class="term-head-meta term-tag is-blue">{{ t(key="readonly", lang=lang | default(value='sk')) }}</span>
  </div>
  <div class="card-body">
    {% if article.excerpt %}
    <p class="term-prose t-yellow"># {{ article.excerpt }}</p>
    <div class="border-t border-base-300 pt-4"></div>
    {% endif %}
    <div class="blog-content term-prose">{{ article.content | safe }}</div>
  </div>
</article>
{% else %}
<header class="term-cmd">
  <div>
    <h1 class="term-title">{{ article.title }}</h1>
    <p class="term-sub">{{ article.view_count }} {{ t(key="blog-views", lang=lang | default(value='sk')) }}</p>
  </div>
  <div class="term-cmd-actions">
    <a href="/blog" class="btn btn-outline btn-sm">[ {{ t(key="cd-up", lang=lang | default(value='sk')) }} ]</a>
  </div>
</header>

<article class="card">
  <div class="term-head">
    <span class="term-head-name">~/blog/{{ article.slug }}.txt</span>
    <span class="term-head-meta term-tag is-blue">{{ t(key="readonly", lang=lang | default(value='sk')) }}</span>
  </div>
  <div class="card-body">
    {% if article.excerpt %}
    <p class="term-prose t-yellow"># {{ article.excerpt }}</p>
    <div class="border-t border-base-300 pt-4"></div>
    {% endif %}
    <div class="blog-content term-prose">{{ article.content | safe }}</div>
  </div>
</article>
{% endif %}
{% endblock content %}
