{% extends "base.html" %}
{% block content %}
<section class="page-section">
  <h1 class="page-title">Tag: {{ tag }}</h1>
  {% for post in posts %}
  <article class="post-card{% if post.type == 'farcaster' %} post-card--farcaster{% elif post.type == 'note' %} post-card--note{% endif %}">
    {% if post.type == 'farcaster' %}
      {% include "partials/summary-farcaster.html" %}
    {% elif post.type == 'note' %}
      {% include "partials/summary-note.html" %}
    {% else %}
      {% include "partials/summary-default.html" %}
    {% endif %}
  </article>
  {% else %}
  <p class="empty-state">No posts for this tag.</p>
  {% endfor %}
  {% if pagination.prev or pagination.next %}
  <nav class="pager" aria-label="Tag pagination">
    <p class="pager__status">Browse tagged posts</p>
    <div class="pager__links">
      {% if pagination.prev %}<a href="{{ pagination.prev | safe }}">← Newer Posts</a>{% endif %}
      {% if pagination.next %}<a href="{{ pagination.next | safe }}">Older Posts →</a>{% endif %}
    </div>
  </nav>
  {% endif %}
</section>
{% endblock content %}

{% block page_scripts %}
{% if posts | selectattr("type", "equalto", "note") | list %}
<script defer src="{{ base_path }}/js/carousel.js"></script>
{% endif %}
{% endblock page_scripts %}
