Free Tool

Shopify Hreflang Tag Generator

Generate valid hreflang link tags, sitemap XML entries, and HTTP header alternatives for Shopify Markets and multi-region stores. Includes x-default support and validation.

Language / region versions

Add one row per language or language+region version of the page. The same page can have multiple language versions (e.g., en-us, en-gb, fr-fr).

Tells Google what to show when no language/region match exists. Usually points to your primary .com domain.

<link rel="alternate" hreflang="en-us" href="https://example.com/" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/en-gb/" />
<link rel="alternate" hreflang="fr-fr" href="https://example.com/fr-fr/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

How to install hreflang on Shopify

Option 1 — Shopify Markets (recommended)

If your store uses Shopify Markets with distinct domains, subdomains, or subfolders per market, hreflang is generated automatically. You don't need to manually add anything. Verify by viewing page source on a market URL and searching for "hreflang".

Use this tool to preview what Shopify will generate, or to debug a Markets setup that's producing unexpected output.

Option 2 — Custom theme code

For non-Markets multi-region setups, paste the generated HTML into your theme's theme.liquid file inside the <head> tag. Wrap it in conditional Liquid logic if the URLs vary per page.

{%- if template != 'cart' -%}
  <link rel="alternate" hreflang="en-us" href="https://yourstore.com{{ canonical_url }}" />
  <link rel="alternate" hreflang="en-gb" href="https://yourstore.co.uk{{ canonical_url }}" />
  <link rel="alternate" hreflang="x-default" href="https://yourstore.com{{ canonical_url }}" />
{%- endif -%}

Option 3 — Sitemap XML

Shopify's default sitemap doesn't support hreflang annotations. To use the sitemap method, you need a custom sitemap app (or a separate hosted XML file submitted to Google Search Console). Better for large catalogs (10,000+ URLs) where HTML page weight matters.

Validation checklist

  • • Every page must have a self-referencing hreflang tag (the page must list itself).
  • Return tags are required. If page A points to page B, page B must point back to page A.
  • • Use ISO 639-1 for language and ISO 3166-1 alpha-2 for region. en-uk is invalid — the correct code is en-gb.
  • • Include x-default for every set of alternates.
  • • Use absolute URLs (with https://). Relative URLs are ignored by Google.
  • • Test with Google Search Console's URL Inspection tool to confirm Google sees the tags.

Why Shopify stores need hreflang

International ecommerce is one of the biggest growth levers for a Shopify store — and one of the easiest places to leak organic traffic. When you launch in a new market, you typically create a separate URL (subfolder, subdomain, or domain) with translated content, localized pricing, and regional shipping. Without hreflang, Google sees those URLs as near-duplicates and either consolidates them under your primary URL (losing regional rankings) or splits ranking authority across them (diluting both).

Hreflang solves that. It tells Google explicitly: this is the same page, but here's the version for each language and region. Google then serves the right version in each Search result, you keep all your ranking authority, and users land on the page priced in their currency.

Common Shopify hreflang mistakes

The most common mistake we see is missing self-references — every page must include an hreflang pointing to itself. The second most common is missing return tags. If your US page lists the UK page as an alternate, the UK page must also list the US page. Search Console's International Targeting report catches both.

The third is using wrong region codes. en-uk is not valid — the country code for the United Kingdom is GB, so it should be en-gb. Similarly, en-eu doesn't exist because Google uses country codes, not regional bloc codes.

When you don't need hreflang

If your store sells in one country with one language — even if you ship internationally — hreflang is not necessary. It only matters when you have distinct URLs for different languages or regions. A single global store at one URL gets ranked by Google's normal geographic signals (server location, business address, links from country-specific domains).

Frequently asked questions

What is hreflang and why does Shopify need it?

Hreflang is an HTML attribute that tells Google which language and regional version of a page to serve to a given user. If your store sells in the US, UK, and France — with separate URLs for each — hreflang prevents Google from treating those pages as duplicate content and ensures the right version ranks in the right country. Shopify Markets generates hreflang automatically when you assign distinct domains, subdomains, or subfolders to each market, but stores running custom multi-region setups or migrating from a non-Markets configuration need to add hreflang manually.

What is x-default and do I need it?

The x-default hreflang tag tells Google which URL to show when no language/region match exists for the user. For most stores, x-default should point to your primary canonical URL — usually your .com domain in English. Google's documentation strongly recommends including x-default for every multi-region setup. Without it, users in unsupported regions may get inconsistent results.

Should I use hreflang in HTML, sitemap, or HTTP headers?

For Shopify stores, HTML link tags in the <head> are the simplest and most common option — they're what Shopify Markets generates by default. Sitemap XML hreflang is better for very large catalogs (10,000+ pages) because it keeps page weight down. HTTP header hreflang is mostly used for non-HTML resources like PDFs. Use one method per page — don't mix.

How do I validate my hreflang is working?

Use Google Search Console → Legacy tools & reports → International Targeting (still available as of 2026), or third-party validators like Merkle's Hreflang Tag Testing Tool and Aleyda Solis's Hreflang Generator/Validator. These catch the most common errors: missing return tags (page A points to page B but B doesn't point back), invalid language codes, and self-referencing tag omissions. Always include a self-referencing hreflang — the page must point to itself.

Does Shopify Markets generate hreflang automatically?

Yes — if you assign a distinct domain, subdomain, or subfolder to each market with a specific language, Shopify generates hreflang tags and an x-default tag automatically on every page. You only need this tool when you're running a custom configuration, debugging existing hreflang, migrating between Markets configurations, or planning a new market launch.

What's the difference between language-only and language+region codes?

A language-only code like "en" targets anyone reading English regardless of country. A language+region code like "en-us" targets English-speaking users specifically in the United States. Use language+region when you have distinct content per region (different pricing, currency, shipping). Use language-only when content is identical across regions but you want to signal language preference. You can mix both — for example en-us, en-gb, and en as a fallback.

Want AI to handle your entire SEO strategy?

Obsess AI automatically generates SEO-optimized blog posts, product descriptions, and meta tags for your Shopify store — in every language you sell in.

Try Obsess AI Free