Skip to content

[GH-3004] Publish sitemaps at documentation language roots - #3309

Merged
jiayuasu merged 2 commits into
apache:masterfrom
MohammedThowfiq:codex/localized-sitemaps
Sep 2, 2026
Merged

[GH-3004] Publish sitemaps at documentation language roots#3309
jiayuasu merged 2 commits into
apache:masterfrom
MohammedThowfiq:codex/localized-sitemaps

Conversation

@MohammedThowfiq

@MohammedThowfiq MohammedThowfiq commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Did you read the Contributor Guide?

Yes, I have read the Contributor Rules and Contributor Development Guide.

Is this PR related to a ticket?

Related to #3004. This addresses the /latest/zh/sitemap.xml 404 shown in the issue's screenshot.

What changes were proposed in this PR?

Material requests a sitemap from the Chinese language root, but mkdocs-static-i18n writes the combined sitemap only at the site root. A post-build hook copies the XML and compressed sitemap to each enabled, non-default language root after the nested language builds finish.

The existing documentation build checks both copies with cmp. No separate test harness or additional dependencies are needed.

This fixes language-root requests; handling of contextual alternate links on nested pages is unchanged.

How was this patch tested?

  • The baseline documentation build reproduced the missing Chinese sitemap.
  • The full fixed MkDocs build and both sitemap comparisons passed locally.
  • Bandit 1.9.4 passed for the documentation hooks with the repository configuration; no suppressions were added.
  • YAML lint and git diff --check passed.

The local MkDocs build has existing missing generated API documentation/link warnings. Java/Scala/R/Python API documentation builds were not run locally; the previous upstream documentation workflow passed.

Did this PR include necessary documentation updates?

No public API changes. The hook documents its purpose.

@jiayuasu

jiayuasu commented Sep 2, 2026

Copy link
Copy Markdown
Member

Thanks for the fix. This seems like a lot of code for one missing sitemap. Could we simplify it, especially the test? The current version also fails the Bandit check.

@MohammedThowfiq

MohammedThowfiq commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Simplified the checks in 583dcb1: removed the 94-line test harness and its separate workflow step. The existing MkDocs build now verifies the XML and gzip sitemap copies with two cmp commands. Bandit 1.9.4 passes with the repository configuration, without suppressions. The full local MkDocs build and both comparisons also pass.

@jiayuasu jiayuasu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@jiayuasu
jiayuasu merged commit 0a8fdb1 into apache:master Sep 2, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants