[Answered ]-How to avoid "a lot of {%include%} gives a lot of <footer>"?

1👍

The pagination should be a file that only renders pagination content, not the template around this.

This thus means that you implement the pagination without the {% extends "app/layout.html" %}, so:

{# pagination.html, no extends or block #}
<div class="pagination">
    <span class="step-links">
        {% if page.has_previous %}
            <a href="?page={{ page.previous_page_number }}">Предыдущая</a>
        {% endif %}
        <span class="current">
            Страница {{ page.number }} из {{ page.paginator.num_pages }}
        </span>
        {% if page.has_next %}
            <a href="?page={{ page.next_page_number }}">Следующая</a>
        {% endif %}
    </span>
</div>

This will prevent the pagination.html to render headers, footers, and other content. You can then simply import the pagination as a utility template.

Leave a comment