---
{
  "layout": "base.njk",
  "title": "series",
  "curr": "series",
  "noendnotes": true
}
---

{% set anchorRe = r/<a(\s|>)/i %}

{% for series in "" | serieses %}
  {% set series_id = series.name | slugify %}
  {% set series_info_id = series_id ~ "--INFO" %}
  {% set common_tags = series.posts | commontags %}
  <section aria-labelledby="{{ series_id }}"
           {% if common_tags.length > 0 %}
             aria-describedby="{{ series_info_id }}"
           {% endif %}
           class="series-listing"
           itemscope
           itemtype="https://schema.org/Collection"
  >
    <header>
      {%- h2 series_id -%}
        <span itemprop="name headline">{{ series.name }}</span>
      {%- endh2 -%}

      {%- if common_tags.length > 0 %}
        <div id="{{ series_info_id }}" class="tags-listing">
          <span class="tags-colon">Tags:&nbsp;</span>
          {#--#}
          <span class="tags-list">
            {%- for tag in common_tags -%}
              <a href="{{ tag | tagpath }}" rel="tag" itemprop="keywords">{{ tag }}</a>
              {%- if not loop.last -%}
                ,
              {% endif -%}
            {%- endfor -%}
          </span>
        </div>
      {%- endif -%}
    </header>

    <ol class="series-list">
      {%- for post in series.posts | datesort(true) -%}
        <li itemprop="hasPart" itemscope itemtype="https://schema.org/BlogPosting">
          {#--#}
          <time itemprop="datePublished" datetime="{{ post.data.date }}">{{ post.data.date }}</time> |
          <a href="{{ post.url }}" itemprop="url"><span itemprop="name headline">
            {%- if post.data.titleHeading -%}
              {%- if anchorRe.test(post.data.titleHeading) -%}
                {{- post.data.title -}}
              {%- else -%}
                {{- post.data.titleHeading | safe -}}
              {%- endif -%}
            {%- else -%}
              {{- post.data.title -}}
            {%- endif -%}
          </span></a>
          {#--#}
        </li>
      {%- endfor -%}
    </ol>
  </section>
{% endfor %}
