Solved

canonical tags

mishania
Visitor
2 0 0

Hello, Need your help, please

can someone explain to me please how can I add a canonical tag to my product page?

Accepted Solution (1)
Elle
Shopify Staff
1092 97 207

This is an accepted solution.

Hi, @mishania 

That's correct!

You do not need to worry about this as the way our themes are built ensure that duplicate content will not be indexed by Google. 


Elle | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

View solution in original post

Replies 11 (11)

Elle
Shopify Staff
1092 97 207

Hi, @mishania 

Are you using a theme from our theme store? If so, you do not need to worry about adding canonical tags!

We've built-in Google-friendly canonical URLs, so your SEO is not impacted by "duplicated" content.

On the internal, it's common for the same content to be accessed through multiple URLs. For example, there are two ways to access the mug in this storefront: 

Canonical URLs are the authoritative or primary URL that's served to Google. Usually, they're the shortest URL. In the above example, the second URL is the one that would be picked up by Google. 

We have a canonical URL for all URLs at Shopify (products, collections, pages, and blogs), so there is no risk of duplicate content.

I hope this helps! 

Elle | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

mishania
Visitor
2 0 0

So i dont need to worry that my product pages are almost the same?

Elle
Shopify Staff
1092 97 207

This is an accepted solution.

Hi, @mishania 

That's correct!

You do not need to worry about this as the way our themes are built ensure that duplicate content will not be indexed by Google. 


Elle | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

amragl
Tourist
3 0 1

Hi Elle,

I have similar issues where the categories+filters seem to be causing duplicates and I am using a Shopify theme.

https://www.fiechi.com/collections/baby-gifts/red

https://www.fiechi.com/collections/baby-gifts/blue

This is being highlighted by a SEO tool I am using. 

Should I not worry then? Or should I use the canonical tags? if so, how do I do it?

Thank you.

Eliot_dav
Shopify Partner
3 0 0

Hi, but can I ask about how SEO for this would work and keyword cannibalisation for these pages? 
The pages have different content but wont get flagged for that, but for SEO they are trying to rank for the same thing and are both indexed.
How can this not affect SEO?
Im really curious and about to have my client remove all these pages are they spread the traffic to pages without any relevant keyword from the pages that should get the traffic (as search console suggests).

And as for canonicals, yes if you create the canonical correctly it should go to the right page for SEO, but i have used metafields and a guide I read that the liquid.file needs to be changed to make the canonical work these days.
Ive done this with anther client recently, mapped all 50 conicals but they wont change still.

Is there a guide on canonical creation for shopify that shopify have?

shopy2
Shopify Partner
5 0 0

As maximum products show is 50 in one page when there are more than 50 products in collection , there are page like, 1,23, with same content like

main page: https://www.fameartgallery.com/collections/acrylic-prints?
page 2: https://www.fameartgallery.com/collections/acrylic-prints?page=2

page page 2 should have canonical tag to main page , rel canonical to https://www.fameartgallery.com/collections/acrylic-prints?
can you tell specific line of code , we should add  which ensure all collection pages with 1,2,3, automatically add canonical tag to main page for all collections

Eliot_dav
Shopify Partner
3 0 0

Hi shopy2, this is called pagination and yes you should have a proper canonical tag for all pages that are numbered beyond 1, so 2,3,4 for your URLs should always have a canonical pointing to page 1 even if they have different products. Shopify should automatically do this, but if not, we have a guide that says the below - Here and under the below heading, you will find the information on how to do this.


6. Pagination Markup
Pagination divides content into multiple pages to help usability and speed.
Our guide explains for the food company tessemaes.com:

A paginated link may take you to “Page 2” of a collection.

The rel="prev" and rel="next" code tells Google to consolidate the pages into one and to send the visitor to the appropriate page—often the first one. You can either use paginated markup in the <head> or on the HTML link elements.

 

Go to a collection with pagination then review the source code.
When on tessemaes.com/collections/all, I see they use <head> markup:

<link rel="next" href="/collections/all?page=2"/>

When on tessemaes.com/collections/all?page=2, I see:

<link rel="prev" href="/collections/all?page=1"/>

The liquid markup to achieve this is:

{% if collection.previous_product %}<link rel="prev" href="{{ collection.previous_product }}">{% endif %}
{% if collection.next_product %}<link rel="next" href="{{ collection.next_product }}">{% endif %}

Shopify automatically handles this rendered markup when you have the following required liquid variable:

{{ content_for_header }}

The URLs can be relative, meaning they can contain no domain directory. Old documentation from Google said they treat rel="previous" as a syntactic variant of rel="prev". Values can be either relative or absolute URLs.

larisanozhovnik
Visitor
2 0 0

I am trying to fix this issue which occurs to Dawn and Sense themes as well but the solutions I found on the web did not resolve this issue. I have asked Chat GPT to suggest the code which follows. I am testing it now.

{% if template == 'product' %}
{% assign first_variant = product.variants.first %}
{% assign canonical_url = product.url %}
{% if first_variant %}
{% assign canonical_url = product.url | append: '?variant=' | append: first_variant.id %}
{% endif %}
<link rel="canonical" href="{{ canonical_url }}">
{% endif %}

 

The code should be added to the head section of the HTML (theme.liquid). Specifically, it should be added between the <head> and </head> tags. Just find this line of code: <link rel="canonical" href="{{ canonical_url }}"> and replace it with the piece of code above.

MomMeAndMore
Tourist
4 0 1

Did this work and are you using Dawn theme? 

larisanozhovnik
Visitor
2 0 0
Hi!
Thank you for your question.
I am in the process of testing this code on my website based on the Sense
theme.
And I have updated it a little bit.
The updated one looks like below:

{% if template == 'product' %}
{% assign first_variant = product.selected_or_first_available_variant %}
{% assign canonical_url = product.url %}
{% if first_variant %}
{% assign canonical_url = canonical_url | append: '?variant=' | append:
first_variant.id %}
{% endif %}

{% endif %}

With regard to the use of the Dawn theme, I help one of my partners with
SEO and he uses two websites based on this theme. He is also testing this
code on his websites.

Eliot_dav
Shopify Partner
3 0 0

Hi,

Did this work?