How to Validate hreflang Using XML Sitemap
Questions:
- Can hreflang be added in sitemap?
- Is sitemap hreflang mandatory?
- What is <xhtml:link> in sitemap?
- What happens if sitemap hreflang is wrong?
Description:
Google allows hreflang implementation via XML sitemap. This KB explains how to validate hreflang links inside sitemap files.
Solution:
- Open sitemap.xml
- Locate <url> a block
- Check <xhtml:link rel="alternate">
- Verify x-default has no prefix
- Ensure language URLs match page URLs
Tips and Tricks:
💡 Things to keep in mind
-
Sitemap hreflang must match HTML hreflang
-
A single mismatch can cause Google to ignore all signals
-
Use sitemap hreflang for large websites