Sitemap generator for Sphinx — Sphinx 8.1+ idioms, parallel-build safe
Project description
sphinx-gp-sitemap
Sitemap generator for Sphinx — a drop-in replacement for
sphinx-sitemap updated
to Sphinx 8.1+ idioms. Same sitemap_* configuration surface, no
multiprocessing.Queue, and a soft (lazy-loaded) dependency on
sphinx-last-updated-by-git
that activates only when sitemap_show_lastmod = True.
Part of the gp-sphinx documentation platform.
Install
$ pip install sphinx-gp-sitemap
When you depend on gp-sphinx, this extension is already loaded — see
Auto-derived values
below. The full config-key reference is auto-generated on the
package docs page
from the live app.add_config_value() registrations.
Minimum viable conf.py
extensions = [
"sphinx_gp_sitemap",
]
site_url = "https://example.com/"
After every HTML-family build, sitemap.xml is written to the output
directory. One <url> element per page; the index of the dirhtml
builder is emitted as the bare base URL (not index/). When
site_url is unset and html_baseurl is also unset, sitemap
emission is skipped silently — the notice is logged at INFO, not
WARNING, so -W strict builds do not fail on undeployed projects.
Auto-derived values when used with gp-sphinx
Projects that build through {py:func}gp_sphinx.config.merge_sphinx_config
do not need to set site_url or sitemap_url_scheme manually. Pass
docs_url= to merge_sphinx_config() and gp-sphinx fills both:
site_urlis normalized to end in/.sitemap_url_schemeis set to"{link}"— flat, no language or version path segment — because git-pull.com sites deploy at the project root.
See the sphinx-gp-sitemap package
page for the integration story
and configuration.md
for the canonical mapping table.
Builder support
| Builder | URL shape | Notes |
|---|---|---|
html |
…/<page>.html (or …<html_file_suffix>) |
Honors html_file_suffix for .htm mirrors |
dirhtml |
…/<page>/ |
Site index emitted as the bare site_url, not …/index/ |
Other builders (text, latex, singlehtml, …) are unaffected — they
do not fire html-page-context, so no sitemap is written.
Multi-language sites
When sitemap_locales is set or auto-detected from locale_dirs,
each <url> gains <xhtml:link rel="alternate" hreflang="…">
entries for every locale. Underscores in locale codes are rewritten
to hyphens for IANA compatibility (pt_BR → pt-BR).
sitemap_locales = ["de", "fr", "ja"]
Use sitemap_locales = [None] to explicitly suppress hreflang
alternates — useful when locale_dirs is populated for translation
workflows that do not produce hreflang-eligible deploys.
Excluding pages
sitemap_excludes = [
"draft/*",
"internal-*",
]
Patterns match the sitemap_link (the relative page URL after the
builder applies its suffix) via fnmatch. The patterns run after
suffix application, so draft/index.html and draft/index/ both
match draft/* regardless of builder.
lastmod from git
sitemap_show_lastmod = True
The first time config-inited fires with this flag set, sphinx-gp-sitemap
runs app.setup_extension("sphinx_last_updated_by_git") to load
sphinx-last-updated-by-git
on demand. Per-page <lastmod> values come from each source file's
latest commit timestamp. If the supporting extension is not
installed, sphinx-gp-sitemap warns once and disables sitemap_show_lastmod
for the rest of the build — <lastmod> is simply omitted.
Differences from sphinx-sitemap
Configuration is drop-in compatible — every sitemap_* key is
registered with the same name, type, and default. Behaviourally the
package is the same except for one explicit trade-off:
- Parallel writes are not declared safe. Collected links live in
env.temp_data["sphinx_gp_sitemap_links"], which Sphinx documents as per-process state and does not merge acrosssphinx-build -j Nworkers. sphinx-gp-sitemap therefore advertisesparallel_read_safeonly. Sites that need parallel writes should run a separate non-parallel pass for sitemap generation, or upstream the env-merge work to this package.
The other differences are implementation modernizations (no
multiprocessing.Queue, public app.builder.name == "dirhtml"
detection rather than monkey-patching, contextlib.suppress(ExtensionError)
around the optional html_baseurl re-registration). These do not
change the configuration surface.
See also
- sphinx-gp-opengraph — companion package for OpenGraph meta-tag emission
- gp-sphinx — the umbrella
docs platform; auto-derives
site_urlandsitemap_url_schemefrom a singledocs_urlargument - sphinx-gp-sitemap package page — integration story, event hooks, and the parallel-write trade-off
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinx_gp_sitemap-0.0.1a11.tar.gz.
File metadata
- Download URL: sphinx_gp_sitemap-0.0.1a11.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb4eab0714fea35afaa714fdddbc19ebbed403aeb582ee795eea583babdd3d25
|
|
| MD5 |
65387bd2d9c31a70232cf4ba14d74697
|
|
| BLAKE2b-256 |
7eba44e8457c3a8bde4cce0b714b68ffbb18104c177a919374bd924421d76e90
|
Provenance
The following attestation bundles were made for sphinx_gp_sitemap-0.0.1a11.tar.gz:
Publisher:
release.yml on git-pull/gp-sphinx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_gp_sitemap-0.0.1a11.tar.gz -
Subject digest:
cb4eab0714fea35afaa714fdddbc19ebbed403aeb582ee795eea583babdd3d25 - Sigstore transparency entry: 1392226007
- Sigstore integration time:
-
Permalink:
git-pull/gp-sphinx@5b1f7ce2a7955105e2c6a0242465ef0a84a16275 -
Branch / Tag:
refs/tags/v0.0.1a11 - Owner: https://github.com/git-pull
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5b1f7ce2a7955105e2c6a0242465ef0a84a16275 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sphinx_gp_sitemap-0.0.1a11-py3-none-any.whl.
File metadata
- Download URL: sphinx_gp_sitemap-0.0.1a11-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4c66fd1f21316b7f7ef2c9cece9214a1eb08741876ae0d88a2ba1c22b5bccb4
|
|
| MD5 |
c5ca4d88c6abe0a798834067929aeaf3
|
|
| BLAKE2b-256 |
ac4012adf6d2870765976f232b4eb17121fbca02c8b4a860a8f37e562f02c5cc
|
Provenance
The following attestation bundles were made for sphinx_gp_sitemap-0.0.1a11-py3-none-any.whl:
Publisher:
release.yml on git-pull/gp-sphinx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_gp_sitemap-0.0.1a11-py3-none-any.whl -
Subject digest:
e4c66fd1f21316b7f7ef2c9cece9214a1eb08741876ae0d88a2ba1c22b5bccb4 - Sigstore transparency entry: 1392226214
- Sigstore integration time:
-
Permalink:
git-pull/gp-sphinx@5b1f7ce2a7955105e2c6a0242465ef0a84a16275 -
Branch / Tag:
refs/tags/v0.0.1a11 - Owner: https://github.com/git-pull
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5b1f7ce2a7955105e2c6a0242465ef0a84a16275 -
Trigger Event:
push
-
Statement type: