{% if model.subtitle %}
  <h2>{{ model.subtitle.value }}</h2>
{% endif %}
<section class="container" aria-label="The posts for the page">
  {% for post in model.posts %}
    <div class="row">
      <div class="col">
        <article>
          <h1>
            <a href="{{ post | relative_link }}" title="Permanent link to &quot;{{ post.title | escape }}&quot;">
              {{ post.title }}
            </a>
          </h1>
          <p>
            Published on {{ post.published_on | date: "MMMM d, yyyy" }}
            at {{ post.published_on | date: "h:mmtt" | downcase }}
            by {{ model.authors | value: post.author_id }}
          </p>
          {{ post.text }}
          {%- assign category_count = post.category_ids | size -%}
          {%- assign tag_count = post.tags | size -%}
          {% if category_count > 0 or tag_count > 0 %}
            <footer>
              <p>
                {%- if category_count > 0 -%}
                  Categorized under: {{ cat_names | reverse | join: ", " }}
                  {%- for cat in post.category_ids -%}
                    {%- assign this_cat = categories | where: "id", cat | first -%}
                    {{ this_cat.name }},
                    {%- assign cat_names = this_cat.name | concat: cat_names -%}
                  {%- endfor -%}
                  {%- assign cat_names = "" -%}
                  <br>
                {% endif -%}
                {%- if tag_count > 0 %}
                  Tagged: {{ post.tags | join: ", " }}
                {% endif -%}
              </p>
            </footer>
          {% endif %}
          <hr>
        </article>
      </div>
    </div>
  {% endfor %}
</section>
