{% extends 'layouts/base.html.twig' %}

{% block title %}#{{ tag.name }} — {{ site.name }}{% endblock %}

{% block content %}
    <section class="page-header">
        <p class="breadcrumb"><a href="/">{{ trans('common.boards') }}</a> / {{ trans('common.tag') }}</p>
        <h1><span class="tag-pill tag-pill-large">#{{ tag.name }}</span></h1>
        <p class="muted">{{ trans('tag.description') }}</p>
    </section>

    {% if topics is empty %}
        <p class="empty">{{ trans('tag.empty') }}</p>
    {% else %}
        {% include 'partials/topic_list.html.twig' with { topics: topics } %}

        {% if total_pages > 1 %}
            <nav class="pagination">
                {% if page > 1 %}
                    <a href="/tag/{{ tag.slug }}?page={{ page - 1 }}">{{ trans('common.previous') }}</a>
                {% endif %}
                <span>{{ trans('common.page_of', { page: page, total: total_pages }) }}</span>
                {% if page < total_pages %}
                    <a href="/tag/{{ tag.slug }}?page={{ page + 1 }}">{{ trans('common.next') }}</a>
                {% endif %}
            </nav>
        {% endif %}
    {% endif %}
{% endblock %}