Hreflang is an HTML attribute that tells search engines which pages on a site are translations of each other and for which language or region each version is intended. Simply put: it's a way to tell Google and Yandex "this page is in Russian for Russia, and this one is in German for Germany, don't show them instead of each other."
Without hreflang, a multilingual site leaves the choice of version to the search engine. If pages in different languages have the same structure and meaning, the search engine may consider them duplicates and leave only one in the search results — usually not the one a specific user needs. Properly configured hreflang removes this uncertainty and separates versions by language and regional segments of the search results.
What is hreflang and why is it needed
hreflang is a rel="alternate" link attribute that tells the search engine which URLs are language or regional variants of the current page.
Without hreflang, the search engine may:
- Show the Russian version to users from Germany
- Consider translations as duplicate content and merge them into one document
- Not show regional versions in corresponding local search results
With hreflang, the search engine knows: this is the German page for Germany, this is the French page for France, and this is the English page for everyone else. It can be used to specify different versions for the same language but different regions, and also to specify multiple languages for one country — for example, English and French for Canada (en-CA and fr-CA). This is important for localization: in Canada, even for French language, prices are indicated in Canadian dollars, while in France they are in euros.
How hreflang looks
The attribute is added to the <head> section of each page:
<link rel="alternate" hreflang="ru" href="https://mysite.com/ru/about/" />
<link rel="alternate" hreflang="en" href="https://mysite.com/en/about/" />
<link rel="alternate" hreflang="de" href="https://mysite.com/de/about/" />
<link rel="alternate" hreflang="x-default" href="https://mysite.com/en/about/" />Key parts:
- rel="alternate" — indicates that this is an alternative version of the page
- hreflang="ru" — language code according to ISO 639-1
- href — the full absolute URL of the version (with protocol and domain)
- hreflang="x-default" — the default version if no other is suitable
Table: common language and region codes
Attribute format: language or language-COUNTRY. Here are the codes that are most often mistaken:
The country code is added only if the content for one language differs in different regions.
- Language only — hreflang="en" — for all English-speaking users regardless of country
- Language + country — hreflang="en-US" for the USA, hreflang="en-GB" for Great Britain — for example, prices in dollars versus pounds
- If the content is the same for all speakers of a language, the language code without the country is sufficient
Reciprocity: the most frequently violated rule
Each page must contain hreflang for all language versions, including itself (self-referencing). This is a critical rule: if you have three languages, each version must link to all three, including itself. This creates a closed set of links, through which the search engine understands the relationship between the versions.
Correct: the Russian page has links to the German, English, and itself. The German page has links to the Russian, English, and itself. The English page has links to the Russian, German, and itself.
Incorrect: the Russian and German versions have links to the English one, but the English version does not have reciprocal links. The search engine considers such an implementation incorrect and may ignore the entire set.
<!-- Example of a correct hreflang set -->
<link rel="alternate" hreflang="de" href="https://mysite.com/de/about/" />
<link rel="alternate" hreflang="ru" href="https://mysite.com/ru/about/" />
<link rel="alternate" hreflang="en" href="https://mysite.com/en/about/" />
<link rel="alternate" hreflang="x-default" href="https://mysite.com/en/about/" />x-default: version for others
hreflang="x-default" — a special value for a page that is shown when no other version is suitable for the user. This is usually the main language version of the site (most often Russian or English).
If you have Russian and Kazakh versions without an English one, x-default can be specified for one of them — or not used at all. This is not a mandatory attribute, but it is recommended by Google.
Implementation Options
In addition to tags in the <head>, hreflang can be specified:
Via HTTP headers. For PDFs and other non-HTML resources, this is the only option.
Via sitemap. Instead of attributes on each page — one sitemap, in which for each link, variants of the same page in other languages are listed. Convenient for large sites on Google's side.
All options are equivalent for Google — choose the one that is easier to maintain. By the way, Multify automatically adds the necessary meta tags both to the HTML code of pages and to the sitemap.
Important distinction: Google and Yandex process hreflang differently
Most Russian-language guides on hreflang are written with only Google in mind — but for sites targeting the Russian internet and CIS, this is only half the picture.
- Google supports all three markup methods: HTML tags in <head>, HTTP headers, and hreflang in XML Sitemap.
- Yandex has stopped supporting hreflang via XML Sitemap. The only reliable way to specify language and regional versions for Yandex is HTML tags <link rel="alternate" hreflang="..."> directly in the <head> of each page.
Practical conclusion: if you have an audience in Yandex (Russia, Kazakhstan, Belarus), do not rely on the sitemap implementation — it will work for Google, but will not be effective in Yandex. The tag in <head> is the only option that works equally well in both systems.