Skip to content

Commit 7a0dd2b

Browse files
committed
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
1 parent 743d66d commit 7a0dd2b

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
furo==2024.8.6
22
sphinx==7.2.6
3-
sphinx-autobuild==2025.8.25
3+
sphinx-autobuild==2024.10.3
44
sphinx-inline-tabs==2023.4.21
55
sphinx-copybutton==0.5.2
66
sphinx-toolbox==3.5.0

‎source/conf.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import pathlib
66
import sys
77

8+
from docutils import nodes
9+
from notfound.utils import replace_uris
10+
811
_ROOT = pathlib.Path(__file__).resolve().parent.parent
912
sys.path.append(os.fspath(_ROOT))
1013

@@ -258,3 +261,13 @@
258261
# Local builds are served from the root, RtD seves from /<language>/<version>/
259262
if not RTD_BUILD:
260263
notfound_urls_prefix = "/"
264+
265+
266+
def fix_notfound_links(app, doctree, docname):
267+
# The extension only makes theme links absolute, not links in the page body
268+
if app.builder.format == "html" and docname == app.config.notfound_pagename:
269+
replace_uris(app, doctree, nodes.reference, "refuri")
270+
271+
272+
def setup(app):
273+
app.connect("doctree-resolved", fix_notfound_links)

0 commit comments

Comments
 (0)