From d95a11d20b88c423e5d5f1f7e394c2c95e885fd6 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:02:25 +0200 Subject: [PATCH 1/4] Add 404 page --- .github/workflows/render.yml | 4 +++- peps/conf.py | 5 +++++ requirements.txt | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/render.yml b/.github/workflows/render.yml index eb9c107b809..ffceabc3be9 100644 --- a/.github/workflows/render.yml +++ b/.github/workflows/render.yml @@ -42,7 +42,9 @@ jobs: python -m pip install --upgrade pip - name: Render PEPs - run: make dirhtml JOBS=$(nproc) + run: | + make dirhtml JOBS=$(nproc) + mv build/404/index.html build/404.html # remove the .doctrees folder when building for deployment as it takes two thirds of disk space - name: Clean up files diff --git a/peps/conf.py b/peps/conf.py index f566a42ee53..8205e011ba3 100644 --- a/peps/conf.py +++ b/peps/conf.py @@ -19,6 +19,7 @@ # Add any Sphinx extension module names here, as strings. extensions = [ + "notfound.extension", "pep_sphinx_extensions", "sphinx.ext.extlinks", "sphinx.ext.intersphinx", @@ -85,6 +86,10 @@ "pypi": ("https://pypi.org/project/%s/", "%s"), } +# sphinx-notfound-page +# https://sphinx-notfound-page.readthedocs.io/en/latest/faq.html#does-this-extension-work-with-github-pages +notfound_urls_prefix = None + # -- Options for HTML output ------------------------------------------------- _PSE_PATH = _ROOT / "pep_sphinx_extensions" diff --git a/requirements.txt b/requirements.txt index ffb858ea649..67f89f4eadf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ Pygments >= 2.9.0 # See https://github.com/sphinx-doc/sphinx/pull/11100 Sphinx >= 5.1.1, != 6.1.0, != 6.1.1, < 8.1.0 docutils >= 0.19.0 +sphinx-notfound-page # For tests pytest From 9dd4932cd9fbf57b40903a2c8d5b01bebd90009d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 31 Dec 2024 11:38:44 +0200 Subject: [PATCH 2/4] Move 404 page in Makefile --- .github/workflows/render.yml | 4 +--- Makefile | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/render.yml b/.github/workflows/render.yml index ffceabc3be9..eb9c107b809 100644 --- a/.github/workflows/render.yml +++ b/.github/workflows/render.yml @@ -42,9 +42,7 @@ jobs: python -m pip install --upgrade pip - name: Render PEPs - run: | - make dirhtml JOBS=$(nproc) - mv build/404/index.html build/404.html + run: make dirhtml JOBS=$(nproc) # remove the .doctrees folder when building for deployment as it takes two thirds of disk space - name: Clean up files diff --git a/Makefile b/Makefile index 373a8a1ee11..25bb1b3d748 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ htmllive: _ensure-sphinx-autobuild html .PHONY: dirhtml dirhtml: BUILDER = dirhtml dirhtml: html +dirhtml: mv $(BUILDDIR)/404/index.html $(BUILDDIR)/404.html ## linkcheck to check validity of links within PEP sources .PHONY: linkcheck From ce96a787fd22c16cb58943f125c51d6d07ba795c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 31 Dec 2024 11:46:01 +0200 Subject: [PATCH 3/4] Move 404 page in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 25bb1b3d748..52cc4e27957 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ htmllive: _ensure-sphinx-autobuild html .PHONY: dirhtml dirhtml: BUILDER = dirhtml dirhtml: html -dirhtml: mv $(BUILDDIR)/404/index.html $(BUILDDIR)/404.html + mv $(BUILDDIR)/404/index.html $(BUILDDIR)/404.html ## linkcheck to check validity of links within PEP sources .PHONY: linkcheck From e26fdd0d689cc382895b9a818304b02ad7635cd5 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 31 Dec 2024 11:48:02 +0200 Subject: [PATCH 4/4] Require version with notfound_urls_prefix Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 67f89f4eadf..ffcbe1a8aa6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ Pygments >= 2.9.0 # See https://github.com/sphinx-doc/sphinx/pull/11100 Sphinx >= 5.1.1, != 6.1.0, != 6.1.1, < 8.1.0 docutils >= 0.19.0 -sphinx-notfound-page +sphinx-notfound-page >= 1.0.2 # For tests pytest