One column per language, one row per page. Out comes a sitemap where every language version lists every other — the part people get wrong by hand.
1
Language versions
Header row of hreflang codes (en, en-GB, de, x-default…), then one row per page with the URL of each language version. Every URL gets the complete set of alternates — itself included — so return links are always correct. Leave a cell empty when a page has no version in that language.
Next: upload sitemap.xml to your site root so it is reachable at https://www.example.com/sitemap.xml, add this line to robots.txt, then submit sitemap.xml in Google Search Console (Indexing → Sitemaps) and Bing Webmaster Tools.
Sitemap: https://www.example.com/sitemap.xml
Why put hreflang in the sitemap
Hreflang tells Google which URL to show to which language or region. You can declare it in HTML <link> tags, HTTP headers or the sitemap. The sitemap is easiest to maintain at scale: no template changes, and one file to review.
The rules that break most implementations: each URL must list itself, every alternate must link back (return links), codes must be valid (en-GB, not en-UK or en_GB), and x-default marks the fallback for everyone else. Building from a grid makes all of that automatic.
Questions
What does x-default do?
It names the page for users whose language or region matches none of your versions — often a language picker or the international English page.
Should I use region codes?
Only when content differs by region (prices, spelling, shipping). en alone targets all English speakers; en-GB and en-US target specific regions.
Does hreflang need to be in both HTML and the sitemap?
No — one method is enough. Mixing methods is allowed but they must agree.
Can I check an existing hreflang sitemap?
Yes. The validator checks codes, self-references and missing return links between URLs in the same file.