Checking hreflang: common markup errors
Checking hreflang finds common markup errors of language versions: one-way links, lack of self-reference, incorrect language codes. An error in one place disables the markup entirely, so it should be checked after each change. The tool is hreflang validator.
Common errors
| Error | Consequence |
|---|---|
| Version refers to another, but that one does not refer back | Pair is ignored: markup must be mutual |
| No self-reference link | Set is considered incomplete |
| Typo in language code | Line does not work; codes are set by standard |
| Region without language | Does not work: region is specified only with language |
| Link to an address with a redirect or error | Connection breaks |
| Non-canonical addresses specified | Conflict with canonical address, search chooses itself |
Language code and country code
Language is recorded with a two-letter code, country — a separate two-letter code after a hyphen. A common confusion: the country code and language code for one territory differ, and one cannot be substituted for the other. If the version is intended for all speakers of the language, the country code is not specified at all — this rule works broader.
Order of checking
- Check one page of each language version — errors are usually systemic, from the template.
- Ensure that all listed addresses respond with code 200.
- Compare addresses with canonical ones — they must match.
- Check the fallback option for other countries, if used.
Does your site need hreflang
| Situation | Needed? |
|---|---|
| Site in one language | No |
| Multiple languages on one domain | Yes |
| One language, but different countries with different prices | Yes, with region specification |
| Translations on subdomains or separate domains | Yes, markup works between domains |
| Auto-translation without separate addresses | No: nothing to mark up |
How we do it
Each knowledge base article exists in four language versions with its own address, and they are linked by this markup — therefore, the English version does not compete with the Russian one. How to switch between them is described in the article about language versions.