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

{% for post in posts %}

<div class="post-index">
  <h2><a class="post-link" href="{{ site.base_url }}{{ post.url }}">{{ post.title }}</a></h2>
  <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 class="excerpt">
      {{ post.excerpt_html | safe }}
  </div>
</div>

{% endfor %}

<div class="pagination">
  {% if paginator.prev_url %}
  <a href="{{ site.base_url }}{{ paginator.prev_url }}" class="previous">&laquo; Prev</a>
  {% endif %}
  <span class="page_number ">Page: {{ paginator.page }} of {{ paginator.n_pages }}</span>
  {% if paginator.next_url %}
  <a href="{{ site.base_url }}{{ paginator.next_url }}" class="next">Next &raquo;</a>
  {% endif %}
</div>


{% endblock %}
