The hreflang attribute gives the language of a linked page and lets a site tell search engines which pages are localised versions of the same content.
The attribute is defined in the HTML Living Standard, the specification of HTML itself, which treats it as advisory only and requires its value to be a valid language tag, such as en or en-GB.
Google uses the annotations to understand how the versions belong together, not to identify their language: it uses neither hreflang nor the HTML lang attribute to detect the language of a page.
According to Google, the annotations must be reciprocal: each language version must list itself as well as all the others, and if two pages do not point to each other, the annotations are ignored. For visitors whose language none of the versions matches, Google suggests considering a fallback page marked with the value x-default. It names two cases in particular: language or country selector pages, and home pages that redirect automatically. That value is a Google convention and not part of the HTML standard.
In multilingual shops we maintain hreflang together with canonicals Canonical A canonical URL is the web address a search engine selects as the most representative of a set of pages with duplicate content; choosing it is called canonicalisation. Read in the glossary → and sitemaps. In the SPQR project, German, English and Swedish run as separate shop versions, with hreflang set up correctly and product translations maintained centrally.
Where the term appears
See also
-
SEO
SEO, or search engine optimisation, is the work of helping search engines understand a site's content and helping people find the site through search and decide whether to visit it.
E-commerce
-
Canonical
A canonical URL is the web address a search engine selects as the most representative of a set of pages with duplicate content; choosing it is called canonicalisation.
E-commerce
Sources
-
Google über lokalisierte Versionen deiner Seite informieren (opens in a new tab)
Google Search Central accessed
-
HTML Living Standard, 4.6 Links (opens in a new tab)
WHATWG accessed