hreflang in XML Sitemap
Declaring the relationships between language versions inside the sitemap file rather than in page headers, which keeps the markup off every page.
Analogy Mental model
Instead of printing twenty language tables on every product box, you hand the customs officer one master index and leave the packaging clean.
In practice What you actually do
Add the XHTML namespace to the sitemap and list each alternate URL beneath its corresponding entry. On a site with hundreds of thousands of pages across several languages, this is the only implementation that does not bloat every response.
Where people get burned Pitfalls
Choose one method and only one. Declaring annotations in both the page and the sitemap means that when the two drift out of sync, the conflicting sets are discarded and the whole configuration stops working.
This entry was written in English from the Chinese original, not machine-translated. Read the Chinese version →