{% extends "base.html" %}
{% block content %}

<div class="post-header">
  <h1 class="post-title">{{ post.title }}</h1>
  <p class="post-meta">
    <span class="post-date">{{ post.date.strftime("%d %b %Y") }}</span>
    • <a class="post-author" href="{{ site.base_url }}{{ site.author[1] }}">{{ site.author[0] }}</a>
    {% if post.topics %} •
      {% for topic in post.topics %}
          {%- if loop.last -%}
            <span class="category"><a href="{{ site.base_url }}/topics/{{ topic }}/">{{ topic | capitalize }}</a></span>
          {%- else -%}
            <span class="category"><a href="{{ site.base_url }}/topics/{{ topic }}/">{{ topic | capitalize }}</a></span>,
          {%- endif -%}
      {% endfor %}
    {% endif %}
    • <span class="meta-item">{{ "{:,.0f}".format(post.wordcount) }} words</span>
  </p>
</div>

<div class="post-content">
{{ content | safe }}
</div>

<nav>
  <ul>
    <li>
      {% if post.prev_post %}
        <a href="{{ site.base_url }}{{ post.prev_post.url }}">← {{ post.prev_post.title }}</a>
      {% endif %}
    </li>
    <li>
      {% if post.next_post %}
        <a href="{{ site.base_url }}{{ post.next_post.url }}">{{ post.next_post.title }} →</a>
      {% endif %}
    </li>
  </ul>
</nav>

{% endblock %}
