Pagination Code Examples

Simple Next/Previous Links

{% if pagination.pageCount > 1 %}
<p>
{% if pagination.previousUrl %}
<a href="{{ pagination.previousUrl }}" title="Previous Page">&lt; Previous</a>{% if pagination.nextUrl %} | {% endif %}
{% endif %} 
{% if pagination.nextUrl %}
<a href="{{ pagination.nextUrl }}" title="Next Page">Next &gt;</a>
{% endif %}
</p>
{% endif %}

Previous/Next with Page Links

{% if pagination.pageCount > 1 %}
<p>
{% if pagination.previousUrl %}
<a href="{{ pagination.previousUrl }}" title="Previous Page">&lt; Previous</a> |
{% endif %}
{% for page in pagination.pagesInRange %}
{% if page.number != pagination.current %}
<a href="{{ page.url }}" title="Go to Page {{ page.number }}">{{ page.number }}</a>
{% else %}
<strong>{{ page.number }}</strong>
{% endif %}
{% endfor %}
{% if pagination.nextUrl %}
| <a href="{{ pagination.nextUrl }}" title="Next Page">Next &gt;</a>
{% endif %}
</p>
{% endif %}

Next/Previous Range Links with Page Link

{% if pagination.pageCount > 1 %}
{% if pagination.previousRangeUrl %}
<a href="{{ pagination.previousRangeUrl }}">&lt;</a>
{% endif %}
{% for page in pagination.pagesInRange %}
{% if page.number != pagination.current %}
<a href="{{ page.url }}" title="Go to Page {{ page.number }}">{{ page.number }}</a>
{% else %}
<strong>{{ page.number }}</strong>
{% endif %}
{% endfor %}
{% if pagination.nextRangeUrl %}
<a href="{{ pagination.nextRangeUrl }}">&gt;</a>
{% endif %}
{% endif %}