How it works
If a page exists in German and English, search engines see two separate pages. hreflang links in the head of each version say that they belong together and which one is for which language:
<link rel="alternate" hreflang="de" href="https://www.example.com/de/">
<link rel="alternate" hreflang="en" href="https://www.example.com/en/">
<link rel="alternate" hreflang="x-default" href="https://www.example.com/">
When someone searches in English, Google then shows the English version, even if the German one has more links. x-default names the version for all other languages, often a language picker or the main language.
If your website has only one language, you do not need hreflang. The language of the page itself goes in the lang attribute; see What the lang attribute does.
What matters
- Both ways. Every version names all the others and itself. If the return link is missing, Google ignores the annotation.
- With x-default. Without it, what users of other languages see is left open. bytereport points it out when it is missing.
- Correct codes. The language per ISO 639-1 (
de,en,fr), optionally with a country per ISO 3166-1 (de-AT,en-GB). A country on its own is not a valid value, and the United Kingdom isGB:en-UKis wrong,en-GBis right. - Full, canonical addresses. Every link points with
https://to a page that answers with status 200 and names itself as canonical. - Matching pages. The English version of a services page points to the German services page, not to the German start page.
How to set it up
Multilingual CMSs and translation plugins add the links themselves once you have linked a page's translations to each other. Check the page source for x-default; some plugins have a separate setting for it.
Without a CMS, the links go into the <head> of every language version, with the same list on all of them. Alternatively they can be given in the XML sitemap, which is tidier with many pages and languages. bytereport's check reads only the links in the head of the start page.