Orange Collar Media
Orange Collar Media
DOCS
OCMLABS/MODULE-SEO · HREFLANG

Magento hreflang tags for multiple store views and languages

  • Magento
  • Adobe Commerce
  • Hyvä

Hreflang tells search engines which version of a page to show to which language or region. For a Magento store with an English and a German store view, it links the two versions of each product to each other so a German searcher lands on the German page.

Hreflang is off by default. Turn on Enable Hreflang Alternates in Stores > Configuration > OCM Labs > SEO > Hreflang for a store with more than one store view.

How-to: hreflang tags for multiple store views, 1:03

What gets alternates

A product, category, or CMS page that exists in two or more store views gets an alternate link for each of them. The current store view is always listed, and a language code is never emitted twice.

Hreflang is not output on:

  • Filtered category pages (layered navigation filters active)
  • Paginated category pages
  • Catalog search results

Language codes

The code comes from each store view’s locale in Stores > Configuration > General > Locale Options, lowercased with a hyphen: en_US becomes en-us.

To use a different code for a store view, set Locale Override at that store view’s scope. It accepts a language optionally followed by a region or script, for example en-GB or de. Invalid values are ignored and the locale is used instead. The override is written in lowercase like any other code, so en-GB is output as en-gb. A common use is two store views on the same locale that serve different regions.

x-default

x-default Store View adds an x-default alternate pointing at the chosen store view’s version of the page, for searchers whose language matches none of your store views. It is added only when that store view has the page.

It is a single default-scope setting, not per website or store view, so every store view’s version of a page lists the same set of alternates, as hreflang requires. Leave it on None to omit x-default.

Caching

Changes to hreflang settings show on pages as they are generated. Flush the full page cache after changing them.