<div id="infinite-wrap">

    {% for nav_item in pages | map(attribute="page") | rejectattr("meta.homepage") | list | paginate(page=page) %}
        {% include 'card.html' %}
    {% endfor %}

</div>

<nav class="navigation posts-navigation" role="navigation">
    <h2 class="screen-reader-text">Posts navigation</h2>
    <div class="nav-links">
        {% if not page.last_page %}
        <div class="nav-previous">
            <a href="{{ config.site_url|url }}page/{{ page.page_num + 1 }}/">
                "Older posts"
            </a>
        </div>
        {% endif %}
        {% if page.page_num == 2 %}
        <div class="nav-next">
            <a href="{{ config.site_url|url }}">
                "Newer posts"
            </a>
        </div>
        {% elif page.page_num > 2 %}
        <div class="nav-next">
            <a href="{{ config.site_url|url }}page/{{ page.page_num - 1 }}/">
                "Newer posts"
            </a>
        </div>
        {% endif %}
    </div>
</nav>

