From 743d66d044825b7c3e4a0908b66698bbc171fd6d Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 26 Oct 2026 16:29:23 -0400 Subject: [PATCH 1/2] feat: add a custom 404 page This will make it easier to remove pages; now the 404 page doesn't take you out of the webpage, and it shows a link to the main page. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Henry Schreiner --- requirements.txt | 3 ++- source/404.rst | 8 ++++++++ source/conf.py | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 source/404.rst diff --git a/requirements.txt b/requirements.txt index 5c710c86bf..9172d28f35 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,8 @@ furo==2024.8.6 sphinx==7.2.6 -sphinx-autobuild==2021.3.14 +sphinx-autobuild==2025.8.25 sphinx-inline-tabs==2023.4.21 sphinx-copybutton==0.5.2 sphinx-toolbox==3.5.0 sphinx-jsonschema==1.19.1 +sphinx-notfound-page==1.1.0 diff --git a/source/404.rst b/source/404.rst new file mode 100644 index 0000000000..77b3d6cfe9 --- /dev/null +++ b/source/404.rst @@ -0,0 +1,8 @@ +:orphan: + +============== +Page not found +============== + +The page you requested does not exist. It may have moved or been removed. +Please return to the :doc:`main page `. diff --git a/source/conf.py b/source/conf.py index 54ab99e81c..8c47b71411 100644 --- a/source/conf.py +++ b/source/conf.py @@ -35,6 +35,7 @@ "sphinx_copybutton", "sphinx_toolbox.collapse", "sphinx-jsonschema", + "notfound.extension", ] nitpicky = True @@ -250,3 +251,10 @@ copybutton_prompt_text = r">>> |\.\.\. |\$ |> " copybutton_prompt_is_regexp = True + +# -- Options for sphinx-notfound-page -------------------------------------------------- +# https://sphinx-notfound-page.readthedocs.io/en/latest/configuration.html + +# Local builds are served from the root, RtD seves from /// +if not RTD_BUILD: + notfound_urls_prefix = "/" From 7a0dd2b7edcfb3f511e2ef54daf20d898f5d1127 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 26 Oct 2026 18:13:25 -0400 Subject: [PATCH 2/2] fix: make 404 body links absolute and support Python 3.10 Pin sphinx-autobuild to 2024.10.3, since 2025.8.25 needs Python 3.11 and the translation workflow uses Python 3.10. Assisted-by: ClaudeCode:claude-opus-5-5 --- requirements.txt | 2 +- source/conf.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9172d28f35..b44df79538 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ furo==2024.8.6 sphinx==7.2.6 -sphinx-autobuild==2025.8.25 +sphinx-autobuild==2024.10.3 sphinx-inline-tabs==2023.4.21 sphinx-copybutton==0.5.2 sphinx-toolbox==3.5.0 diff --git a/source/conf.py b/source/conf.py index 8c47b71411..f80e6e98be 100644 --- a/source/conf.py +++ b/source/conf.py @@ -5,6 +5,9 @@ import pathlib import sys +from docutils import nodes +from notfound.utils import replace_uris + _ROOT = pathlib.Path(__file__).resolve().parent.parent sys.path.append(os.fspath(_ROOT)) @@ -258,3 +261,13 @@ # Local builds are served from the root, RtD seves from /// if not RTD_BUILD: notfound_urls_prefix = "/" + + +def fix_notfound_links(app, doctree, docname): + # The extension only makes theme links absolute, not links in the page body + if app.builder.format == "html" and docname == app.config.notfound_pagename: + replace_uris(app, doctree, nodes.reference, "refuri") + + +def setup(app): + app.connect("doctree-resolved", fix_notfound_links)