Skip to content

Commit 743d66d

Browse files
committed
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 <henryfs@princeton.edu>
1 parent 721a338 commit 743d66d

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎requirements.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
furo==2024.8.6
22
sphinx==7.2.6
3-
sphinx-autobuild==2021.3.14
3+
sphinx-autobuild==2025.8.25
44
sphinx-inline-tabs==2023.4.21
55
sphinx-copybutton==0.5.2
66
sphinx-toolbox==3.5.0
77
sphinx-jsonschema==1.19.1
8+
sphinx-notfound-page==1.1.0

‎source/404.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
:orphan:
2+
3+
==============
4+
Page not found
5+
==============
6+
7+
The page you requested does not exist. It may have moved or been removed.
8+
Please return to the :doc:`main page <index>`.

‎source/conf.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"sphinx_copybutton",
3636
"sphinx_toolbox.collapse",
3737
"sphinx-jsonschema",
38+
"notfound.extension",
3839
]
3940

4041
nitpicky = True
@@ -250,3 +251,10 @@
250251

251252
copybutton_prompt_text = r">>> |\.\.\. |\$ |> "
252253
copybutton_prompt_is_regexp = True
254+
255+
# -- Options for sphinx-notfound-page --------------------------------------------------
256+
# https://sphinx-notfound-page.readthedocs.io/en/latest/configuration.html
257+
258+
# Local builds are served from the root, RtD seves from /<language>/<version>/
259+
if not RTD_BUILD:
260+
notfound_urls_prefix = "/"

0 commit comments

Comments
 (0)