Shopify SEO: Fixing Duplicate Content Issues from Pagination

The Shopify platform provides an easy solution for many to manage their eCommerce sites. Shopify also offers out-of-the-box duplicate content issues which is not good for SEO ranking.

Duplicate content negatively impacts ranking performance when multiple URLs are showing the same content. This forces Google to decide which URL to assign higher ranking to, and it may give a higher/lower ranking to the wrong URL.

Luckily, there are adjustments that developers can apply to improve their SEO ranking. Let’s jump into how you can fix one of the most common causes of this issue on the Shopify collections pages.

Pagination on the Collection Pages

On collection pages with more than one page of products, the pagination links will point to different sets of products within the collection.

If you click the pagination button to go to page two, and then click the pagination button to page one, you can see that you get a URL with the parameter ‘?page=1’ appended to the end.

The URLs will go in the sequence :
yourstore.com/collections/tickets > yourstore.com/collections/tickets?page=2 > yourstore.com/collections/tickets?page=1

This action creates the URL yourstore.com/collections/tickets?page=1 and duplicates the content of the URL yourstore.com/collections/tickets.

 

The Solution

To solve this issue we need to remove the ‘?page=1’ from the URL. You will need to use a bit of JavaScript to change the link to page one with the parameter.

 

Below is a snippet of JavaScript that developers have used for clients to get the desired results.

if($(".pagination").length) {
  var nmlink = $(".pagination .prev").next("span").find("a").attr("href");
  if(nmlink.indexOf("?page=1") >= 0) {
    let newlink = nmlink.replace('?page=1','');
    $(".pagination .prev").next("span").find("a").attr("href", newlink);
  }
  if($(".pagination .prev").length){
    if($(".pagination .prev a").attr("href").indexOf("?page=1") >= 0) {
      let newlink = nmlink.replace('?page=1','');
      $(".pagination .prev a").attr("href", newlink);
    }
  }
}

Place the code within script tags at the bottom of the file where the pagination code lives (in most themes it’s the collection-pagination.liquid file) or in your site’s main js file.

This JavaScript searches the pagination to find any instances of ‘?page=1‘. If it finds it, it will remove it from the URL within the pagination.

This will help eliminate Shopify duplicate content created by the pagination.

There are some alternative routes you can explore such as Better Shopify Pagination, where you replace the entire pagination snippet altogether. It will solve your issue but you run the risk of having to restyle the look of the pagination on your collections pages.

Conclusion

This might not be the only SEO improvement you need to make on your Shopify site, but by understanding the duplicate content issues and the available solutions you’ll put your site in a more favorable ranking with search engines.

Our hope is that this gives you the knowledge to implement these changes yourself, or leads you in the right direction to creating your customized solution.

If you are not a developer or don’t have the support to solve these issues on your own, contact us! We are ready to help.