{% extends "base.html" %}

{% block content %}

<h2 class="text-indigo-200">
  Categories & Tags
</h2>
<p>
{% set categories = get_taxonomy(kind="categories") %}
  {% for term in categories.items %}
      <a class="no-underline text-slate-50" href="{{ term.permalink }}">/{{ term.name }}
      ({{ term.pages | length }})</a>&nbsp;
  {% endfor %}
</ul>
</p>

<p>
{% set tags = get_taxonomy(kind="tags") %}
  {% for term in tags.items %}
    <a class="no-underline text-slate-50" href="{{ term.permalink }}">#{{ term.name }}
    ({{ term.pages | length }})</a>&nbsp;
  {% endfor %}
</ul>
</p>

{% for year, posts in section.pages | group_by(attribute="year") %}
    <h3 class="text-indigo-200">{{ year }}</h3>

    {% for post in posts %}
    <p>
      <div>
        {{ post.date }}
      </div>
      <div>
        <a class="text-sky-200 no-underline text-xl" href="{{ post.permalink }}">{{ post.title }}</a>
      </div>
      <div>
          {% if post.taxonomies.categories %}
              {% for category in post.taxonomies.categories %}
              &emsp;<a class="no-underline text-slate-50" href="{{ get_taxonomy_url(kind="categories", name=category) | safe }}">/{{ category }}</a>
              {% endfor %}
          {% endif %}
          {% if post.taxonomies.tags %}
              {% for tag in post.taxonomies.tags %}
              &emsp;<a class="no-underline text-slate-50" href="{{ get_taxonomy_url(kind="tags", name=tag) | safe }}">#{{ tag }}</a>
              {% endfor %}
          {% endif %}
      </div>      
    </p>
    {% endfor %}
    
{% endfor %}

{% endblock content %}
