Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
My current pagination format is:
https://poptopia.us/collections/new?page=2
https://poptopia.us/collections/funko-pop?page=2
But I need the URL format to be:
https://poptopia.us/collections/new/2
https://poptopia.us/collections/funko-pop/2
Using Javascript I was able to modify the pagination URL like this:
https://poptopia.us/collections/{{ collection.url }}/2/
...but it doesn't show/put the name of the current collection instead it shows: {{ collection.url }}
How can I displayed the name of the collection there?
Here is the Javascript code i am implementing:
document.addEventListener('DOMContentLoaded', function() { var paginationLinks = document.querySelectorAll('.pagination a'); var collectionUrl = '{{ collection.url }}'; paginationLinks.forEach(function(link) { var pageUrl = link.getAttribute('href'); var pageNumber = pageUrl.substring(pageUrl.lastIndexOf('=') + 1); link.setAttribute('href', collectionUrl + '/' + pageNumber + '/'); }); });
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025