{% extends "page/titled/default.html.twig" %}

{% block body %}
    <div class="col-12">
        <div class="body">
            <form class="form">
                <div class="mb-3">
                    <label for="query" class="label">Mots clés</label>
                    <input id="query" class="input input-bordered w-full" name="query" type="text" value="{{ query }}" />
                </div>
                <input class="btn btn-primary" type="submit" value="Chercher">
            </form>
        </div>
    </div>

    {% if pager %}
        {% for post in pager %}
            {% if not loop.first %}
                <hr class="col-12">
            {% endif %}

            {{ include('page/post/_post.html.twig', {post: post}) }}
        {% endfor %}

        {% if pager.getPaginationData.pageCount > 1 %}
            <div class="col-12">
                <div class="body">
                    <div class="pager align-right">
                        {% block pager %}
                            {{ include('module/_pager.html.twig', {
                                route: _node.routeName,
                                routeParams: {query: query, _domain: _domain},
                                pages: pager.paginationData.pageCount,
                                currentPage: pager.paginationData.current
                            }) }}
                        {% endblock %}
                    </div>
                </div>
            </div>
        {% endif %}
    {% endif %}
{% endblock %}

{% block metas %}
    {#
    {{- parent() -}}

    {% if page.pager.hasPreviousPage %}
        <link rel="prev" href="{{ cms_path('posts', {page: page.pager.getPreviousPage}, true) }}" />
    {% endif %}

    {% if page.pager.hasNextPage %}
        <link rel="next" href="{{ cms_path('posts', {page: page.pager.getNextPage}, true) }}" />
    {% endif %}
    #}
{% endblock %}
