hreflang: markup of language versions
hreflang is a markup that informs search engines that a page has versions in other languages or for other countries, and which version is intended for whom. Without it, a multilingual site risks competing with itself.
How it looks
Each language version lists all versions, including itself, indicating the language and, if necessary, the region. Additionally, a fallback option for other countries is specified. The markup can be placed in the page code, in response headers, or in the sitemap — the method does not matter, completeness does.
Rules that are most often violated
| Rule | What breaks when violated |
|---|---|
| Links must be reciprocal | One-sided markup is completely ignored |
| Each version links to itself | The set is considered incomplete |
| Addresses are canonical and working | Redirect or 404 nullifies the link |
| Language code by standard | Typo in the code disables the rule |
| Region specified only with language | One region without a language does not work |
When it is needed
- The site exists in multiple languages.
- There are versions in one language for different countries — for example, for Ukraine and Poland.
- Part of the content is translated, and part is not: then only real existing pairs are marked up.
Common confusion: language and country
The language code is mandatory, the country code is not. A record with only the language means “this version is for everyone who reads in this language,” while with both language and country — “for this language in this country.” It is not allowed to specify one region without a language: such a line is ignored. And remember that the region here refers to the user's country, not where the server is located.
How to check
Look at the page source code and ensure that the versions are fully and mutually listed. In our knowledge base, for example, each article exists in four languages with its own address — and they are linked precisely by this markup; details in the article about language versions.