How to setup hreflang tags based on the main URL of the page on Shopify?
How to setup hreflang tags based on the main URL of the page on Shopify?
I want to add hreflang tags based on the main URL of the page on Shopify. However, when I'm trying to set this up on Shopify, my site's German version URLs are becoming the default for all versions in the hreflang tags. I also want to include the English version in the hreflang tags. I have achieved this dynamically using the canonical variable in the theme.liquid file, but I want the hreflang tags to be based on the main URL loaded on the page. How can I set this up properly?
This code I have written in the theme.liquid file:
<link rel="alternate" hreflang="en" href="{{ canonical_url | replace: '.com', '.com/en'}}">
<link rel="alternate" href="{{ canonical_url | replace: '.com', '.com/en'}}" hreflang="x-default" />
<link rel="alternate" hreflang="de" href="{{ canonical_url }}">
<link rel="alternate" hreflang="de-ch" href="{{ canonical_url | replace: '.com', '.com/de-us'}}">
<link rel="alternate" hreflang="en-ch" href="{{ canonical_url | replace: '.com', '.com/en-ch'}}">
<link rel="alternate" hreflang="de-gb" href="{{ canonical_url | replace: '.com', '.com/de-gb'}}">
<link rel="alternate" hreflang="en-gb" href="{{ canonical_url | replace: '.com', '.com/en-gb'}}">
<link rel="alternate" hreflang="de-us" href="{{ canonical_url | replace: '.com', '.com/de-us'}}">
<link rel="alternate" hreflang="en-us" href="{{ canonical_url | replace: '.com', '.com/en-us'}}">
English version of the site Translated with the Shopify Weglot app. I can't understand why it's happening.
Here are two versions of my site:
https://lisa-eleni.com/
https://lisa-eleni.com/en
Turbo Multi-language Translator
Make the better internet purchasing globaly
Turbosify SEO Speed Booster
5.0 (7)•Free plan available
Get better conversions by improving store loading speed
Installed
Turbo Multi-language Chat - AI Customer service in one hand