Definition
Hreflang is an annotation that tells search engines which language and, optionally, which country a page is meant for, so the right version of the same content is shown to the right audience. It is expressed as a set of alternate link annotations, in the head of each page, in HTTP headers, or in an XML sitemap, and every version in a set has to reference every other version including itself.
One product across three markets
- Canadian English page
- Annotated as en-ca, listing itself and both other versions
- Canadian French page
- Annotated as fr-ca, listing the same complete set
- United States page
- Annotated as en-us, listing the same complete set
- Fallback entry
- An x-default annotation pointing at the version served to visitors no other entry fits
- Language and region format
- A two letter language code, optionally followed by a two letter country code, with language always present
- Where the annotations live
- The head of each page or a single XML sitemap that carries the set for every URL, chosen once and used consistently
- What each URL must be
- Indexable, canonical to itself, and returning the content the annotation promises
An illustrative set for a store selling into two countries in two languages. The requirement people most often miss is that the references have to be reciprocal, so a version left out of one page's set weakens the whole group.
Why it matters
Hreflang matters to cross-border stores because without it the wrong page wins. A Canadian shopper can land on the United States storefront with prices in the wrong currency, duties they were not expecting and a shipping promise the store cannot keep, and the bounce that follows costs a sale that was already won. It also settles a duplication problem: two pages in the same language for different countries are near-identical, and the annotation tells search engines they are deliberate regional alternatives rather than copies. It does not improve rankings on its own. What it does is make sure the ranking a page already earned is spent on the right audience.
Where it goes wrong
- Non-reciprocal sets, where one version lists the others but is not listed back, which causes the annotation to be disregarded for that pair
- Using a country code where a language code belongs, such as annotating a page for the United Kingdom without stating the language, which is not a valid value
- Pointing annotations at URLs that redirect, carry a canonical to somewhere else, or are blocked from indexing, since the target has to be the page that will actually be served
- Maintaining the set by hand on a catalogue that changes weekly, where a discontinued product leaves broken references across every market until someone notices
- Assuming currency and shipping are handled: the annotation influences which URL is shown, and the page it points at still has to price and ship correctly for that market
Questions about hreflang
Does an online store need hreflang for one country in two languages?
Yes, and it is the clearest case for it. Two language versions of the same catalogue serving one country are exactly what the annotation exists for, and without it search engines have to guess which to show. A store selling only in one country in one language does not need it at all, no matter how much international traffic it happens to receive.
Where should hreflang annotations be implemented?
Pick one location and keep everything there. Page head annotations are easy to inspect and add weight to every page load on a large catalogue. An XML sitemap keeps the markup off the pages entirely and suits stores with many URLs and many markets. Mixing the two invites contradictions, which are harder to diagnose than a missing annotation.
How does Shopify Markets handle hreflang?
When markets are configured with their own domains, subfolders or subdomains and languages are published, Shopify generates the alternate annotations for the market versions of each page. The usual work is verifying that the generated set matches the markets you actually sell to, that unpublished languages are not being announced, and that any custom template changes have not disturbed the output.