Your pages
List every version of the same page, one per line. Put the locale first, then a comma, then the full URL.
- Locale is a language code on its own, such as
en,deorfr. Add a country code when you have separate versions for separate countries:en-GB,en-US,de-AT. - URL must be the full address, starting
https://. A relative path will not work. - x-default is the version to show when none of the others match the visitor. Usually your global or English page. Optional, but worth having.
- One line per version, including the page you are on. A set that leaves itself out is ignored by Google.
Your tags
Every page in the set needs the full block, including its own line. That is the rule most sites get wrong.
Hreflang tells Google which version of a page to show in which country or language. It does not make a page rank. If the wrong country's page is showing, this is usually the fix. If nothing ranks anywhere, this is not.