How to change the product link on collection pages to canonical URL?

How to change the product link on collection pages to canonical URL?

jaffri
Shopify Partner
1 0 0

Google Search Console is reporting all product links that contain the collection slug as 'Not Indexed - Alternate page with proper canonical tag'. 

 

Here is an example of a product canonical URL

https://warehoos.com/products/6-mil-poly-cgsb-multiple-sizes

 

The link to this product from a collection page is

https://warehoos.com/collections/vapour-barrier/products/6-mil-poly-cgsb-multiple-sizes

 

Links like these are being increasingly flagged by Google Search Console with the above issue.

 

I want to modify the collection page code so that the link to the products are their canonical URLs without the collection slug. 

 

Can someone please guide me which file to edit. I am using Empire theme. 

Replies 2 (2)

ilanadavis
Shopify Partner
209 27 71

Hey @jaffri 

 

You can use this article to guide you on removing what's called the collection-aware URLs.

https://www.ilanadavis.com/blogs/articles/remove-collection-from-shopify-urls

 

I don't have the Empire theme so I can't tell you which theme file but you can look through your files to find within:collection

Ilana Davis, Shopify Superhero
JSON-LD for SEO, adds structured data to your theme, getting you more organic traffic with Rich Results.
Linking Llama, link complementary, comparable, or related products to improve SEO & UX.

claricelin
Shopify Partner
148 19 30

Hi @jaffri ,

  1. Under Online Store, Go to Themes.
  2. Click on the three dots next to Customize button, click on Edit Code.
  3. Go to the section Snippets and click to expand the details.

 

Look for a file named "product-card-media-gallery." You can edit the code from there.

I believe depending on your Theme, the file could be named slightly differently.

 

Hope that helps.

 

Best of luck,

Clarice

I help store owners to double their traffic and sales by getting on Google and YouTube page one. Check out my YouTube channel for more tips and tactics to drive traffic and sales ➤ https://youtube.com/claricelin

Download my Shopify Marketing Guide to learn both FREE & PAID ways to drive visitors to your store that convert into paying customers. ➤https://claricelin.com/shopify-marketing-guide/