A simple Sphinx extension that generates an XML sitemap from navigation pages.
Project description
Simple Sphinx XML Sitemap Extension
This project provides a minimal Sphinx extension that generates an XML sitemap
for your documentation. The extension inspects the navigation structure of your
project and writes a sitemap.xml file after the HTML build step completes.
The extension does not support internationalisation or multiple languages, but it is suitable for most single language documentation sites.
Installation
Install from PyPI using pip:
pip install simple-sphinx-xml-sitemap
Alternatively add it to your pyproject.toml or requirements.txt file.
Usage
Add the extension to the extensions list in your Sphinx conf.py file and
set html_baseurl to the public URL where the documentation will be hosted.
extensions = [
# other extensions
'simple_sphinx_xml_sitemap', # note the user of underscores
]
html_baseurl = 'https://example.com/docs/'
Build your documentation as normal. The sphinx-build command becomes
available after installing the project's dependencies (for example with
uv):
sphinx-build -b html docs docs/_build
After the build completes a sitemap.xml file will be present in the output
folder.
Examples
The examples/ directory contains small projects showing different ways to use
the extension. The project is configured as a uv workspace so these examples can
declare simple-sphinx-xml-sitemap as a dependency in their own
pyproject.toml files.
docs
This directory contains only a Sphinx project. To build it run:
cd examples/docs
uv venv
source .venv/bin/activate
uv pip install -e .
sphinx-build -b html . _build
The example conf.py excludes the .venv directory created above so that
Sphinx does not try to parse files inside the virtual environment.
hello_world
This example is a tiny Python package with a documentation folder and its own
pyproject.toml. Build the docs and install the package in editable mode:
cd examples/hello_world
uv venv
source .venv/bin/activate
uv pip install -e .
sphinx-build -b html docs docs/_build
Both examples will produce a sitemap.xml alongside the HTML output.
Running the tests
Create a virtual environment using uv, install the development dependencies,
and run the tests with pytest -q:
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
pytest -q
Why
Search engines often crawl every file of a Sphinx build, including sources and module documentation pages that may not be useful. Providing an XML sitemap allows you to indicate which pages are important and helps search engines index your documentation correctly.
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 simple_sphinx_xml_sitemap-0.1.2.tar.gz.
File metadata
- Download URL: simple_sphinx_xml_sitemap-0.1.2.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2683067e537db0bac942940a6ca6ff30f5b3a813666495c7efe483cf1e59ff81
|
|
| MD5 |
ee74121282379d585b416747835e5ad8
|
|
| BLAKE2b-256 |
c98827a72400b9d44989e0e3cc8e1e24a908787fc2c842f2197d57b50f62211f
|
Provenance
The following attestation bundles were made for simple_sphinx_xml_sitemap-0.1.2.tar.gz:
Publisher:
publish.yml on mdrideout/simple-sphinx-xml-sitemap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_sphinx_xml_sitemap-0.1.2.tar.gz -
Subject digest:
2683067e537db0bac942940a6ca6ff30f5b3a813666495c7efe483cf1e59ff81 - Sigstore transparency entry: 245669495
- Sigstore integration time:
-
Permalink:
mdrideout/simple-sphinx-xml-sitemap@b8fc5943500fba40deffbb8af61c3f0208154a5f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mdrideout
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b8fc5943500fba40deffbb8af61c3f0208154a5f -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file simple_sphinx_xml_sitemap-0.1.2-py3-none-any.whl.
File metadata
- Download URL: simple_sphinx_xml_sitemap-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bec97958981ff4469ef35eaed47e1e43112c366890a3914c1c3f6c7c7b73f51
|
|
| MD5 |
7986afd801cd37be7082d0d34f1d6363
|
|
| BLAKE2b-256 |
74460c1e500b07ba96fce2ed1467a2a2008ca0f65033bb69a8ceee8ca002a41d
|
Provenance
The following attestation bundles were made for simple_sphinx_xml_sitemap-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on mdrideout/simple-sphinx-xml-sitemap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_sphinx_xml_sitemap-0.1.2-py3-none-any.whl -
Subject digest:
5bec97958981ff4469ef35eaed47e1e43112c366890a3914c1c3f6c7c7b73f51 - Sigstore transparency entry: 245669497
- Sigstore integration time:
-
Permalink:
mdrideout/simple-sphinx-xml-sitemap@b8fc5943500fba40deffbb8af61c3f0208154a5f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mdrideout
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b8fc5943500fba40deffbb8af61c3f0208154a5f -
Trigger Event:
workflow_run
-
Statement type: