You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Docs: sphinx-notfound-page doesn't show nicer 404 page #125895
Ideally there would be a way to define this via a pattern (e.g. /{language}/{version}/), but currently it is only a static string.
We can't use that static string because we don't know the language ahead of time though, as we use -D language=XX on the command line. So I don't see a good way of resolving this.
in conf.py should help here. The links will be able to fetch the static resources just fine, no matter if the nginx error_page directives will be set per build or globally. Please see #139386.
My PR with above change has been closed. I think it should be reopened and merged, as a 404 page linking to stable version of docs on all paths that would end with 404 is better than the standard raw nginx 404 page.
We can track improvements for 404 pages per language and version in follow-ups.
I appreciate it looks nicer, but semantically it is the wrong thing to do to redirect a user from e.g. /fr/3.8/le_spam.html to /3/404.html. If the notfound page extension adds support for template substitutions, I'd be happy to revisit it, but we shouldn't make the wrong change here.
I've added a feature request in sphinx-notfound-page for substitution of language. Apparently there's no need for substitution of version as we already have it in conf.py.
Activity
hugovk commentedon Oct 23, 2024
I can see the extension is installed in the venv on the docs server, for example:
I'm not sure what's up, perhaps it's some Nginx config?
But at least it is useful on the previews, and there is a plan to host the docs on Read the Docs: python/docs-community#5.
AA-Turner commentedon Oct 31, 2024
It's because the prefix defaults to
/en/latest.Ideally there would be a way to define this via a pattern (e.g.
/{language}/{version}/), but currently it is only a static string.We can't use that static string because we don't know the language ahead of time though, as we use
-D language=XXon the command line. So I don't see a good way of resolving this.A
hugovk commentedon Nov 1, 2024
It's useful for RTD previews, so I suggest we either leave it be, or only install it for RTD builds.
It's not a heavy dependency, so I lean towards leaving it be.
nineteendo commentedon Nov 1, 2024
Can't you use an environment variable, as those can be retrieved in
conf.py.m-aciek commentedon Sep 28, 2025
in
conf.pyshould help here. The links will be able to fetch the static resources just fine, no matter if the nginx error_page directives will be set per build or globally. Please see #139386.m-aciek commentedon Sep 29, 2025
My PR with above change has been closed. I think it should be reopened and merged, as a 404 page linking to stable version of docs on all paths that would end with 404 is better than the standard raw nginx 404 page.
We can track improvements for 404 pages per language and version in follow-ups.
AA-Turner commentedon Sep 29, 2025
I appreciate it looks nicer, but semantically it is the wrong thing to do to redirect a user from e.g.
/fr/3.8/le_spam.htmlto/3/404.html. If the notfound page extension adds support for template substitutions, I'd be happy to revisit it, but we shouldn't make the wrong change here.A
m-aciek commentedon Sep 29, 2025
I've added a feature request in sphinx-notfound-page for substitution of
language. Apparently there's no need for substitution ofversionas we already have it inconf.py.gh-125895: Fix static asset location for `sphinx-notfound-page` (#147984
pythongh-125895: Fix static asset location for `sphinx-notfound-page` (…
pythongh-125895: Fix static asset location for `sphinx-notfound-page` (…
[3.14] gh-125895: Fix static asset location for `sphinx-notfound-page` (
[3.13] gh-125895: Fix static asset location for `sphinx-notfound-page` (
pythongh-125895: Fix static asset location for `sphinx-notfound-page` (…