You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sedona.apache.org by ji...@apache.org on 2026/09/02 17:29:43 UTC

(sedona) branch master updated: [GH-3004] Publish sitemaps at documentation language roots (#3309)

This is an automated email from the ASF dual-hosted git repository.

jiayuasu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a8fdb1f9e8 [GH-3004] Publish sitemaps at documentation language roots (#3309)
0a8fdb1f9e8 is described below

commit 0a8fdb1f9e8c8236dde73731df704c55027778f7
Author: Mohammedthowfiq <49...@users.noreply.github.com>
AuthorDate: Wed Sep 2 20:29:37 2026 +0300

    [GH-3004] Publish sitemaps at documentation language roots (#3309)
---
 .github/workflows/docs.yml            |  6 ++++-
 docs-overrides/hooks/i18n_sitemaps.py | 44 +++++++++++++++++++++++++++++++++++
 mkdocs.yml                            |  1 +
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 9e162187453..25a35b75146 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -110,7 +110,11 @@ jobs:
       # user happens to own a placeholder email address.
       - run: git config --global user.name "github-actions[bot]"
       - run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
-      - run: uv run mkdocs build
+      - name: Build documentation and check localized sitemaps
+        run: |
+          uv run mkdocs build
+          cmp site/sitemap.xml site/zh/sitemap.xml
+          cmp site/sitemap.xml.gz site/zh/sitemap.xml.gz
       - name: Deploy the doc to the website branch
         if: ${{ github.event_name != 'pull_request' && github.repository == 'apache/sedona' }}
         run: |
diff --git a/docs-overrides/hooks/i18n_sitemaps.py b/docs-overrides/hooks/i18n_sitemaps.py
new file mode 100644
index 00000000000..fe7434c6761
--- /dev/null
+++ b/docs-overrides/hooks/i18n_sitemaps.py
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Expose the combined sitemap at the language roots requested by Material."""
+
+from pathlib import Path
+from shutil import copyfile
+
+from mkdocs import plugins
+
+
+@plugins.event_priority(-110)
+def on_post_build(config, **kwargs):
+    """Copy sitemaps after i18n has finished all of its nested language builds."""
+    i18n = config.plugins["i18n"]
+    if i18n.building:
+        return
+
+    site_dir = Path(config.site_dir)
+    for locale in i18n.build_languages:
+        if locale == i18n.default_language:
+            continue
+        for filename in ("sitemap.xml", "sitemap.xml.gz"):
+            source = site_dir / filename
+            if source.is_file():
+                # i18n emits one combined sitemap at the site root. Material
+                # resolves sitemap.xml against each alternate language URL.
+                destination = site_dir / locale / filename
+                destination.parent.mkdir(parents=True, exist_ok=True)
+                copyfile(source, destination)
diff --git a/mkdocs.yml b/mkdocs.yml
index 693eeb14805..b3e1e58c24d 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -383,6 +383,7 @@ plugins:
       canonical_version: 'latest'
 hooks:
   - docs-overrides/hooks/i18n_blog_passthrough.py
+  - docs-overrides/hooks/i18n_sitemaps.py
   - docs-overrides/hooks/blog_star_cta.py
 extra_css:
   - assets/stylesheets/extra.min.css