diff --git a/docs/conf.py b/docs/conf.py index 0ca473096..faf01c896 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -45,6 +45,7 @@ "sphinx_design", "autoapi.extension", "notfound.extension", + "sphinxext.rediraffe", ] # Add any paths that contain templates here, relative to this directory. @@ -86,6 +87,10 @@ # Define the canonical URL using custom domain on Read the Docs html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") +# Redirects for moved/deleted pages, handled by sphinxext-rediraffe. Paths are relative to +# the docs folder, e.g. "user_guide/examples/tutorial_old.ipynb": "user_guide/examples/tutorial_new.ipynb" +rediraffe_redirects = {} + # Tell Jinja2 templates the build is running on Read the Docs if os.environ.get("READTHEDOCS", "") == "True": if "html_context" not in globals(): diff --git a/docs/development/index.md b/docs/development/index.md index ba60335d2..b2f770e58 100644 --- a/docs/development/index.md +++ b/docs/development/index.md @@ -134,6 +134,8 @@ See below for more Pixi commands relevant to development. - `pixi run docs-watch` - Build and auto-rebuild documentation when files change (useful for live editing) - `pixi run docs-linkcheck` - Check for broken links in the documentation +If you move or delete a documentation page, add an entry to `rediraffe_redirects` in `docs/conf.py` so that existing links to the page keep working. + **Code quality** - `pixi run lint` - Run pre-commit hooks on all files (includes formatting, linting, and other code quality checks) diff --git a/pixi.toml b/pixi.toml index 942f3cb8b..c4d521bb2 100644 --- a/pixi.toml +++ b/pixi.toml @@ -128,6 +128,7 @@ sphinxcontrib-mermaid = "*" sphinx-design = "*" sphinx-autoapi = "*" sphinx-notfound-page = "*" +sphinxext-rediraffe = "*" vale = "*" [feature.docs.tasks]