Shopify SEO: Removing ?page=1 from URLs

Stephen Keable
3 min readOct 15, 2019

Moz put out a good guide of things you can do to improve SEO on a Shopify store this week. One we will concentrate on today is about pagination links, we all know them, the run of numbers at the foot of a collection page.

The problem highlighted by the article is that these inadvertently create duplicate page problems for example on the first page the initial URL is something like:-


Then once you click through to page two, the link back is like this:-


However the markup for these two URLs will be identical. So the Moz article recommends:

…having a developer adjust the internal linking structure so that the first paginated result points to the canonical page

So thought I’d offer up some code to help you or your developer solve this.

NOTE: If this is too technical please of course hire a developer to help you

Time for some code

So the first thing to fix this in your theme template is to move away from using Shopify’s default {{ paginate }} Liquid tag. Which saves time but has it’s limitations. Typically switching to some code within a snippet and including the snippet in place of this tag is the best approach.

This GitHub repo has some code we use for our pagination.

A lot of that code is related to adding additional ARIA attributes for accessibility. The most basic code we need for this SEO task is, adding this filter to the url tags:-

Filter code:-
| replace: '?page=1', ''
{{ paginate.previous.url }}
{{ paginate.previous.url | replace: '?page=1', '' }}

We then apply this method to the URLs for the previous page link and the numbered links to pages. The eagle eyed among you might be saying won’t this break on page 10–19 and again at 100+, which it will so we wrap it in some conditionals to prevent this.

For the previous link:
{%- if paginate.current_page == 2 -%}
For the numbered links:
{%- if part.title == "1" -%}
Stephen Keable

Shopify partner, JavaScript/Liquid/Swift developer, convert to serverless architecture and builder of digital products people love to use since 1999.