Liquid, JavaScript, themes, sales channels
Hello there,
We are currently doing SEO optimization of our shopify stores selling learning towers. As part of SEO, we want to deploy hreflang. The interesting thing about our shops is that we sell in the DACH region - Germany, Switzerland, and Austria, and the shops are actually one shop with masked redirects loaded on multiple domains from one server. So if I make a change to one shop, I make it automatically to everyone else. URL adresses of the stores are www.tukataka.de, www.tukataka.at and www.tukataka.ch.
We have already solved how to add hreflang for all domains. It is possible with help of this Liquid code and inserting it in theme.liquid before /head tag:
<link rel="alternate" hreflang="de-de" href="{{ canonical_url | replace: shop.domain, 'www.mystore.de' }}" />
<link rel="alternate" href="{{ canonical_url | replace: shop.domain, 'www.mystore.at' }}" hreflang="de-at" />
<link rel="alternate" href="{{ canonical_url | replace: shop.domain, 'www.mystore.ch' }}" hreflang="de-ch" />
Or with this one (a bit simpler):
<link rel="alternate" href="https://beispielshop.de{{product.url}}{{collection.url}}{{page.url}}{{article.url}}" hreflang="de-de" />
<link rel="alternate" href="https://beispielshop.at{{product.url}}{{collection.url}}{{page.url}}{{article.url}}" hreflang="de-at" />
<link rel="alternate" href="https://beispielshop.ch{{product.url}}{{collection.url}}{{page.url}}{{article.url}}" hreflang="de-ch" />
Both are fine.
The problem is that if I insert this code into theme.liquid before /head tag, Shopify automatically adds hreflang canonical tag pointing to homepage:
Hreflang is not in theme.liquid, but it somehow appears in website code:
The canonical hreflang tag appears immediatelly after adding any hreflang alternate tag. The canonical tag appears automatically after adding any hreflang alternate. And its not in theme.liquid code. Therefore, I believe probably Shopify adds it automatically on the background.
Thus, my question is how to remove the hreflang canonical tag? Any ideas? Thanks.
Best regards,
Michal
Solved! Go to the solution
This is an accepted solution.
Hi Ben @Ben1000
Shopify generates its own sitemap: store.url/sitemap.xml. You dont have to upload this sitemap to Search Console. Insted you can download this sitemap and add hreflang tags into it. Or you can generate it via CrazyFrog. And then upload this sitemap with hreflang tags to Shopify files and add the files URL to Search console. And do this for all shops. You can update the file every 1 month, or 2-4 months, depending on the shop size and SEO priority.
The shop I mentioned in my first post uses masked cloaking - the same website is loaded on three domains - for Germany, Austria, aund Switzerland. (We modify the content with GTM.) The process is similar, but the shop had to generate 3 sitemaps, upload them to the same Files section, and then add to three GSC account.
EDIT: Or you can you an app. App is the simplest solution. But in your case we couldnt use app because of the masked cloaking.
Hope this helps,
Michal
Same problem! It should be the solution to turn off shopify automatic generated hreflangs tags
Find solution! shopify Markets make a mess with hreflang. Deactivate and it will be gone duplicated hreflang @michalc524
Hi @DariusWS
@DariusWS wrote:Find solution! shopify Markets make a mess with hreflang. Deactivate and it will be gone duplicated hreflang @michalc524
Can you explain further what do you mean?
I have the same problem.
Thanks
Same problem. Shopify markets should have option to turn off auto hreflang generating!
We dont use Shopify Markets, intead we have 2 separate stores. Shopify auto-generates hreflang tags even in this case. 😕
Maybe that will help:
That is what the liquid code below does:
<link rel="alternate" hreflang="x-default" href="{{ canonical_url | replace: shop.domain, 'www.mystore.com' }}" /> <link rel="alternate" href="{{ canonical_url | replace: shop.domain, 'www.mystore.com' }}" hreflang="en-GB" /> <link rel="alternate" href="{{ canonical_url | replace: shop.domain, 'www.us.mystore.com' }}" hreflang="en-US" />
This code snippet can be added into the section of your theme.liquid file. You need to replace the ‘mystore.com’ instances with your actual domain names. When this snippet is in place, your pages will output hreflang tags using the page canonical to construct the URL path.
Source:
https://eastsideco.com/blog/everything-you-need-know-about-hreflang-and-shopify
Hi, we already tested this code and it doesnt work. Please first read the problem in post n. 1 - before posting spammy links.
Hi @michalc524,
My apologies, I see the last paragraph I wrote is somehow not appear in my last message and that led to this confusion of me not seeing the first solution you tried.
After trying all methods I found on the internet, I placed it in the <head> section of my site theme.liquid (not before like you did) and I think it's working well, Shopify isn't automatically adds hreflang canonical tag pointing to homepage.
If I missed something let me know, I also tried to learn if maybe I missed something.
Thanks
Good for you, unfortunately for the two shops i manage the situation is different.
But we already found a solution: add hreflang tags to sitemap 🙂
Hi, I used standard sitemap + hreflang guide, for example: https://searchengineland.com/how-to-implement-the-hreflang-element-using-xml-sitemaps-123030
But I dont use the native Shopify sitemap, because it cant be edited. Instead I download the sitemap every 2 Months and add the hreflang tags there. And then I update it manually in Search console.
What do you think about this solution? Any tips to make it better? 🙂
Hi @michalc524,
Apparently my solution is not working anymore, again Google Search is showing searches in English, although the primary language is Dutch as you can see (from theme.liquid - inside the head section):
<link rel="alternate" href="{{ canonical_url | replace: shop.domain, 'www.tegeketen.nl' }}" hreflang="x-default"/>
<link rel="alternate" href="{{ canonical_url | replace: shop.domain, 'www.tegeketen.nl' }}" hreflang="nl" />
<link rel="alternate" href="{{ canonical_url | replace: shop.domain, 'www.tegeketen.nl/en' }}" hreflang="en" />
So I'm trying your solution.
By "update it manually in Search console" do you mean that you manually add all the links one by one to the search.google.com sitemap?
I also tried to follow the example from the given link you shared but got an error when I tried to upload it
Can you give an example and show step by step how to add?
Thanks
Hi @michalc524,
I think I understood your solution better, I only don't understand the last part.
How do you update it manually in Search console?
Best,
Ben
This is an accepted solution.
Hi Ben @Ben1000
Shopify generates its own sitemap: store.url/sitemap.xml. You dont have to upload this sitemap to Search Console. Insted you can download this sitemap and add hreflang tags into it. Or you can generate it via CrazyFrog. And then upload this sitemap with hreflang tags to Shopify files and add the files URL to Search console. And do this for all shops. You can update the file every 1 month, or 2-4 months, depending on the shop size and SEO priority.
The shop I mentioned in my first post uses masked cloaking - the same website is loaded on three domains - for Germany, Austria, aund Switzerland. (We modify the content with GTM.) The process is similar, but the shop had to generate 3 sitemaps, upload them to the same Files section, and then add to three GSC account.
EDIT: Or you can you an app. App is the simplest solution. But in your case we couldnt use app because of the masked cloaking.
Hope this helps,
Michal
Hi @michalc524,
Thanks for your advice. Did you mean Screaming Frog?
Besides, I tried an app in the past, and it didn't work well for me. If my website is with the same domain:
Can I do the same thing via Screaming Frog or should I proceed with another option?
Thanks
Hi @Ben1000
Yes, exactly, I meant Screaming Frog and yes, you can use Hreflang Sitemap Tags even for content in different languages on the same website. You should contant a SEO expert and discuss with him, how to add the hreflang tags into a sitemap, and of course he should check if the setup is ok.
Eventually you can find in Ahrefs if some page has active Hreflang language variations and check it there too. But the key move is to contact a SEO expert.
Best regards
Michal
Hi @michalc524,
Thank you so much for your help. I see Screaming Frog let using hreflang only for paying customers. I hope to find a free tool, if not I will use Screaming Frog and contact SEO expert
Thanks!
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024