Skip to content

Instantly share code, notes, and snippets.

@lukearmstrong
Last active December 6, 2023 00:41
Show Gist options
  • Save lukearmstrong/5553488 to your computer and use it in GitHub Desktop.
Save lukearmstrong/5553488 to your computer and use it in GitHub Desktop.
Shopify - Show links to all pages in pagination, gets rid of the "..."
<div id="pagination">
<ul>
{% if paginate.previous %}
<li>{{ paginate.previous.title | link_to: paginate.previous.url }}</li>
{% endif %}
{% for i in (1..paginate.pages) %}
{% if paginate.current_page == i %}
<li>{{ i }}</li>
{% else %}
<li><a href="?page={{ i }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if paginate.next %}
<li>{{ paginate.next.title | link_to: paginate.next.url }}</li>
{% endif %}
</ul>
<p>
Showing items {{ paginate.current_offset | plus: 1 }}-{% if paginate.next %}{{ paginate.current_offset | plus: paginate.page_size }}{% else %}{{ paginate.items }}{% endif %} of {{ paginate.items }}.
</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment