Duplicate content - removing links to non-canonical product pages from collection pages

Hi everyone, i have an issue with duplicate content on a website i’m managing.

Shopify is creating duplicate versions of each product on different URLs. For example:

https://www.artisandelimarket.co.uk/products/the-banquet-hamper

can also be found on:

https://www.artisandelimarket.co.uk/collections/cheese-wine-hampers/products/the-banquet-hamper

The second URL canonicalises to the first URL, which is good. However, all links to products on collection pages point to the second (canonicalised) version which is bad. For example on:

https://www.artisandelimarket.co.uk/collections/hampers

the only link to the Banquet Hamper is https://www.artisandelimarket.co.uk/collections/cheese-wine-hampers/products/the-banquet-hamper, when i actually want it to link to https://www.artisandelimarket.co.uk/products/the-banquet-hamper

I’ve looked at guides online, and they say to open Shopify admin panel > Sales channels > Online store > Themes > Actions > Edit code > Navigate to the “Snippets” folder and find the “product-grid-item.liquid” file > Locate the following line of code:

<a href=”{{ product.url | within: collection }}” class=”product-grid-item”>

and change it to

<a href=”{{ product.url }}” class=”product-grid-item”>

HOWEVER, i can’t find the “product-grid-item.liquid” file, and i’ve searched for it by exact name in the code base. The site runs on the Dawn v1.1 theme. Could someone please confirm whether the fix i’ve outlined above will work for this site? If so, could you please point me to the correct folder, page and line of code so i can make the change? If not, i’d appreciate an alternate, efficient solution.

Thank you!

Hi Charlie, I’m having exactly the same problem. Did you find a solution?

1 Like

Hi Charlie, I’m also in the process of trying to reduce the URL duplication… to fix the above issue the easiest way I’ve found is to download a search extension for shoplift themes (chrome browser) I found this allows you to search all the actual code of the theme so that you can find and change the bits you need e.g. " | within: collection" https://chrome.google.com/webstore/detail/shopify-theme-file-search/mhchmhfecfdpaifljcfebnlaiaphfkmb?hl=en

Hope that helps

hope that helps