hreflang: when your site exists in more than one language
SEOAs soon as a page exists in more than one language, a problem arises that cannot be solved without a technical declaration: how is a search engine supposed to know that the German and the English version are the same page — and not two competing pieces of content?
4 min read
By Timo Wessels Published
As soon as your site exists in more than one language, a problem arises: how is a search engine to know that the German and the English version are the same page and not two pieces of content competing with each other?
That is what hreflang is for. These are lines in the page head (the invisible part of the HTML). For each language version they say at which address it lives and for which language and region it is meant.
If you have only one language, you can stop here. This does not concern you.
The most important points first:
- Every language version must name all the others, itself included. Otherwise Google ignores the information.
- From a single page the mistake never looks wrong. It sits in the relationship between the pages.
- Add
x-defaultfor everybody whose language you do not offer.
Why it matters
Mutual reference
Almost everything hangs on one rule: every language version must name all the others, itself included. Google writes: if two pages do not both point to each other, the information is ignored. This is meant to stop someone from outside claiming at will that their page is a version of yours.
The tricky part: read from any single page, the markup looks right. The mistake exists only between the pages. That is why it survives for years in many projects.
If hreflang is missing or ignored, Google may show the wrong language version. A German searcher then lands on the English page although the German one exists.
Valid codes
The value consists of a language code and optionally a region code, separated by a hyphen: en-US, de-AT, de-CH. The language code comes first. Google does not allow giving a country code alone. at alone is not a language code, de-AT means German in Austria.
Then there is x-default. This is the fallback page for everybody whose language is named nowhere. Google recommends it especially for pages where you choose a language or country, and for home pages that redirect automatically.
The address structure
There are three common ways, and Google describes their pros and cons:
- Own country domain (
example.de): a clear signal for one country, but more expensive, needs more set-up and can address only a single country. - Subdirectory (
example.com/en/): easy to set up, little upkeep, everything on the same domain. - Subdomain (
en.example.com): easy to set up, allows different server locations. The downside: users cannot tell from the address whether “en” means a language or a country.
My choice from practice: subdirectories, unless there is a concrete reason for country domains, for instance when a client serves exactly one market. I would not choose subdomains. That is my experience and not a rule from Google.
How to check it yourself
Open the page source of the German page with Ctrl+U and search for hreflang. Write down all the addresses that stand there. Then open each of these addresses and do the same. At the end every page must name every other page and itself.
That is tedious, but with three to five language versions it is done in a few minutes. And it is the only test that really checks the mutual reference.
Watch the spelling: a hyphen between language and region, language code in lower case, region code in capitals (de-CH).
The practical test: search Google for a term from your English page and see which version appears.
What you can do if it is missing
1. Check the links between translations, not just the plugin. In WordPress a multilingual plugin does the markup. If it is still incomplete, individual pages mostly lack the link to their translation. Then the return reference is missing for exactly that page. Every page must be assigned to its translation in the back end.
2. Add x-default for the version where someone should land whose language you do not offer.
3. Make sure hreflang and canonical say the same. The canonical is the statement of which address is the main version of a page. If an English page points by canonical to the German one, it takes itself out of the index, and the best hreflang markup no longer helps. That is my experience.
4. If you are only planning: choose subdirectories unless there is a concrete reason for country domains.
Sources
- Google Search Central, Tell Google about localized versions of your page — each version names itself and all others; without mutual reference the tags are ignored;
x-default; the code built from language and region with a hyphen, a country code alone is not allowed: developers.google.com(external site: developers.google.com) - Google Search Central, Managing multi-regional and multilingual sites — the table of address structures with pros and cons: developers.google.com(external site: developers.google.com)
- Own testing practice — the choice of subdirectories, the dislike of subdomains, checking by hand, the links between translations in the plugin, hreflang and canonical in agreement.