{#- The numbered pages between Previous and Next, only where the count is exact and pages have numbers: the first, the last, and the ones either side of this one. The rows come before their total, so these are sent again once it is in. -#} {%- set exact = page.total is not none and not page.estimated and not page.at_least -%} {%- if exact and not page.keyset and page.limit %} {% set last = [((page.total + page.limit - 1) // page.limit), 1]|max %} {% for number in range(1, last + 1) if number == 1 or number == last or (number - page_number)|abs <= 1 %} {% if not loop.first and number - loop.previtem > 1 %} {% endif %} {% set address = urls.here(page=number if number > 1 else None) %} {{ number }} {% endfor %} {%- endif -%}