How can I fix the 'No self-referencing hreflang' SEO error on my pages?

coffeemand
Tourist
6 0 1

Hi All Shopify Guru's :-),

I have had an SEO report done and it is returning a report that 100's of pages have the following error:

"No self-referencing hreflang". I am using the Impluse theme and have spent lots of time looking online to find a fix but cannot find one. I am hoping that someone knows how to fix this one?

Thanks

Replies 3 (3)

magecomp
Shopify Partner
264 20 32

Hello @coffeemand 

 

The error "No self-referencing hreflang" means that the page does not have a hreflang tag that points to itself. This is important for SEO because it helps Google understand that the page is available in multiple languages.

To fix this error in the Impulse theme, you can add the following code to the theme.liquid file:

{% for language in languages %} <link rel="alternate" hreflang="{{ language.code }}" href="{{ canonical_url | replace: '{{ shop.domain }}', '{{ shop.domain }}/{{ language.code }}' }}" /> {% endfor %}

This code will add a hreflang tag for each language that is supported by your store. The hreflang tag will point to the same page, but with the language code in the URL.

For example, if you have a page that is available in English and French, the hreflang tag for the English version of the page would be:

<link rel="alternate" hreflang="en" href="https://example.com/en/my-page" />

The hreflang tag for the French version of the page would be:

<link rel="alternate" hreflang="fr" href="https://example.com/fr/my-page" />

By adding these hreflang tags to your pages, you can help Google understand that your pages are available in multiple languages and improve your SEO.

Helping voluntarily. Please like and accept the solution if it helps. Thanks!
Our Bestseller Shopify Apps    |      Mobile App Builder by MageComp    |      Limit Qty Purchase

Need a developer?  Just visit MageComp website
coffeemand
Tourist
6 0 1

Thank you for the reply. Does it matter where in the code I put this. Also, I am getting the error for over 700 pages. Do I need to add this for each page ? 

<link rel="alternate" hreflang="en" href="https://example.com/en/my-page" />

 

coleatkinson
Shopify Staff
141 13 76

We automatically add hreflang tags for every market you sell into. This warning is over zealous (we have consulted with SEO experts internally) and is not something you should be concerned with. As I mentioned, for every country/market that you sell into, we create a hreflang tag for you to tell Google and other search engines that it is a regional version of the same page.

Cole | Product @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