ultrabug / mkdocs-static-i18n

MkDocs i18n plugin using static translation markdown files
https://ultrabug.github.io/mkdocs-static-i18n/
MIT License
228 stars 38 forks source link

Generated sitemap is incomplete #194

Closed jonaharagon closed 1 year ago

jonaharagon commented 1 year ago

Google is clear (as mud) that each URL (not just each canonical URL) needs its own <url> block in a sitemap, so this:

<url>
     <loc>https://ultrabug.github.io/mkdocs-static-i18n/</loc>
     <lastmod>2022-01-31</lastmod>
     <changefreq>daily</changefreq>
     <xhtml:link rel="alternate" hreflang="en" href="https://ultrabug.github.io/mkdocs-static-i18n/"/>
     <xhtml:link rel="alternate" hreflang="fr" href="https://ultrabug.github.io/mkdocs-static-i18n/fr/"/>
</url>

Should actually be this:

<url>
     <loc>https://ultrabug.github.io/mkdocs-static-i18n/</loc>
     <lastmod>2022-01-31</lastmod>
     <changefreq>daily</changefreq>
     <xhtml:link rel="alternate" hreflang="en" href="https://ultrabug.github.io/mkdocs-static-i18n/"/>
     <xhtml:link rel="alternate" hreflang="fr" href="https://ultrabug.github.io/mkdocs-static-i18n/fr/"/>
</url>
<url>
     <loc>https://ultrabug.github.io/mkdocs-static-i18n/fr/</loc>
     <lastmod>2022-01-31</lastmod>
     <changefreq>daily</changefreq>
     <xhtml:link rel="alternate" hreflang="en" href="https://ultrabug.github.io/mkdocs-static-i18n/"/>
     <xhtml:link rel="alternate" hreflang="fr" href="https://ultrabug.github.io/mkdocs-static-i18n/fr/"/>
</url>

https://developers.google.com/search/docs/specialty/international/localized-versions#sitemap

Therefore if you have 3 versions of a page, your sitemap will have entries for the URLs of each version, and each entry will have 3 identical child entries.

ultrabug commented 1 year ago

Newer 1.0.0 version gives complete and validated sitemap.xml, closing