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

{% block title %}{{ pt('all_categories') }} - {{ site_name }}{% endblock %}
{% block meta_description %}{{ pt('all_categories_desc') }} - {{ site_name }}{% endblock %}

{% block schema %}
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "CollectionPage",
  "name": "{{ pt('all_categories') }}",
  "url": "{{ request.url }}",
  "description": "{{ pt('all_categories_desc') }}"
}
</script>
{% endblock %}

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

{% if categories %}
<div class="ap-hub-grid">
    {% for cat_name, count in categories %}
    <a href="{{ url_for('view_category', category_name=cat_name) }}" class="ap-hub-card">
        <span class="ap-hub-card__name">{{ cat_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_categories') }}</p>
</div>
{% endif %}
{% endblock %}
