{% load wagtailcore_tags %}

{% for post in posts %}
  <dt class="meta-data">
    {% if year and forloop.counter == 1 %}<h2>{{ year }}</h2>{% endif %}
    {% if post.published %}
      Published <span>{{ post.published }}</span>
      {% if post.updated %}
        <br />Updated <span>{{ post.updated }}</span><br />
      {% endif %}
    {% endif %}
    {% if post.latest_draft %}
      <span><a href="{{ post.draft_url }}">Last draft</a></span>
      <span>{{ post.latest_draft }}</span>
    {% endif %}
    {% if post.page_type %}<div class="page-type">{{ post.page_type.indefinite_article|capfirst }}
      {% if post.tags %}, tagged:{% endif %}
    </div>{% endif %}
  </dt>
  <dd class="preview">
    <h3>{% if post.published %}<a href="{{ post.url }}">{% endif %}{{ post.title }}{% if post.published %}</a>{% endif %}</h3>
    {% if post.summary %}{{ post.summary|richtext }}{% endif %}
  </dd>
{% endfor %}
