Use hreflang tags in your theme
Search engines use hreflang tags to serve the right language or region version of a page to each customer. If your store uses Shopify Markets, then Shopify adds these tags to your theme automatically.
This page provides general guidance about hreflang tags. For specific SEO guidance for your store, contact an SEO expert. You can find Partners with SEO expertise in Shopify's Partner Directory.
This page provides general guidance about hreflang tags. For specific SEO guidance for your store, contact an SEO expert. You can find Partners with SEO expertise in Shopify's Partner Directory.
Anchor to How it worksHow it works
Shopify adds hreflang tags to your theme automatically through the content_for_header object, which your theme renders in the <head> of layout/theme.liquid. These tags:
- Reflect each market's languages and regions, so a country-specific market produces a region-qualified tag like
fr-caoren-us, while a broader market produces a language-only tag likefr. - Update automatically when you add, remove, or change a market's domains or languages.
- Stay in sync with each page's canonical URL, so that search engines treat localized URLs as related versions of the same page.
Adding your own tags on top of the automatic ones can produce duplicate or conflicting annotations, which can hurt your store's search ranking.
Adding your own tags on top of the automatic ones can produce duplicate or conflicting annotations, which can hurt your store's search ranking.
Shopify's automatic tags already cover most stores, including region-specific markets, but in some cases you might want to manage hreflang tags yourself.
If your theme or a third-party app already outputs hreflang tags, then turning off the automatic tags ensures that only one source outputs tags and prevents your store's search ranking from being negatively impacted.
You might also need your own tags for a setup that Shopify Markets can't coordinate for you, such as linking alternate versions of a page across separate Shopify stores on different domains.
To turn off automatic tags, go to Online store > Preferences in your Shopify admin. In the Social sharing and SEO section, turn off Automatic hreflang tags.
If you add your own hreflang tags in layout/theme.liquid:
- Build the tags dynamically from the
localizationobject, so that they reflect the store's active markets and languages. Don't hardcode domains or resource handles. A hardcoded collection or product handle doesn't work, because a resource's handle can differ in each language, and the<head>inlayout/theme.liquidrenders on every page. - Make sure that each localized URL references itself as its own canonical URL.
For guidance on hreflang syntax and best practices, refer to Google's documentation.
Anchor to Next stepsNext steps
- Learn how Shopify handles SEO for multiple currencies and languages.
- Refer to Shopify's international SEO guidance for markets.