Created
November 21, 2013 20:26
-
-
Save kyleaparker/7588995 to your computer and use it in GitHub Desktop.
Shopify: Show all numbers in pagination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign count = paginate.pages %} | |
{% for part in (1..count) %} | |
<li {% if paginate.current_page == part %}class="active"{% endif %}><a href="{{ collection.url }}?page={{ forloop.index }}">{{ forloop.index }}</a></li> | |
{% endfor %} |
Thanks for the above code.
While I appreciate this simplistic approach, I found an issue with the search page. Since the search adds a q=search
parameter, the query parameter would be lost when changing pages since the href
is hardcoded in your example.
I published an updated gist that retains the query parameter by using the generated page.next.url
links:
https://gist.github.com/IliasDeros/10cbdf4b6ba9e610ae82d725bff7d56f
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I use this filters module to display my products, do you know a way to make it work with your gist ?
Thanks !
— G