How do I set up Google's Canonical Tag for Matrix items (Set a preferred URL for your content)

Canonical tags from Google allow e-commerce store owners to publicly specify your preferred version of a URL. If your site has identical or vastly similar content that’s accessible through multiple URLs, this format provides you with more control over the URL returned in search results. This happens when you have shoes or clothes items in many different sizes and/or colours.
Here’s Google’s Canonical Tag Explanation

For matrix items there is a page for each child item in a matrix. As a result, Google will index each matrix item and penalise your SEO by identifying the pages as duplicates. You can add the meta tag <canonical> which will point to the primary item and only the parents item page will be indexed by Google.

To use the canonical tag, add the following markup to the Header Template inside the <head>: tag

<link rel="canonical" href="{product['product_canonical_link']}"/>

You can do this in your WebStore Manager
Go to the Top Menu → Settings → Edit Templates → Header
If you don’t see the above menu, please ask Nitrosell Customer Support to move you to branch 5

You also need to replace this code in your header:

<meta property="og:url" content="{product['product_ link']}" />


<meta property="og:url" content="{product['product_canonical_link']}" />

After you have saved the template and made it live, you’ll be able to see this code in the product pages of your matrix items

<link rel="canonical" href="" />

Please contact Nitrosell Customer Support if you are unsure about any of the above.

Hi Neil,
If we do this, then from the matrix which item is chosen as the primary item that google will index?

Hi Emma,

The canonical item of a matrix is chosen as follows:

We first look at any primary item that you have specified in PAM or in the case you haven’t picked any we select the item with the lowest ID.

Hope this helps,