{% extends 'public/base.html' %}

{% block title %}{{ pt('all_tags') }} - {{ site_name }}{% endblock %}
{% block meta_description %}{{ pt('all_tags_desc') }} - {{ site_name }}{% endblock %}

{% block hreflang %}
{#- Hub-style hreflang: every active language is an equal version of this
    listing. Default language lives on the clean URL, others carry ?lang=.
    No x-default: the engine treats all languages as equals (same policy
    as the sitemap). -#}
{%- for version in all_versions %}
{%- if version.language == (default_language or 'en') %}
<link rel="alternate" hreflang="{{ version.language }}" href="{{ request.base_url }}" />
{%- else %}
<link rel="alternate" hreflang="{{ version.language }}" href="{{ request.base_url }}?lang={{ version.language }}" />
{%- endif %}
{%- endfor %}
{% endblock %}

{% block schema %}
<script type="application/ld+json">{{ page_schema | tojson | safe }}</script>
{% endblock %}

{% block content %}
<div class="ap-page__header ap-page__header--centered">
    <h1 class="ap-page__title">{{ pt('all_tags') }}</h1>
    <p class="ap-page__subtitle">{{ pt('all_tags_desc') }}</p>
</div>

{% if tags %}
<div class="ap-hub-grid">
    {% for tag_name, count in tags %}
    <a href="{{ url_for('view_tag', tag_name=tag_name) }}" class="ap-hub-card">
        <span class="ap-hub-card__name">{{ tag_name }}</span>
        <span class="ap-hub-card__count">{{ count }} {{ pt('post_singular') if count == 1 else pt('posts_plural') }}</span>
    </a>
    {% endfor %}
</div>
{% else %}
<div class="ap-empty-state">
    <p>{{ pt('no_tags') }}</p>
</div>
{% endif %}
{% endblock %}
