Closed hugovk closed 1 year ago
Thanks for reporting this issue.
It seems it's a bug in Read the Docs itself. We do have a check in place for 404/index.html
but for some reason it doesn't find it in your project.
I guess it's because it's not detected as HTMLDIR. I'll research a little and come back with the solution... Hopefully 😅
My guess was correct. Since you are using build.commands
(in beta), we don't really know what's the "documentation type" of that version of your documentation. Because of that, we set it as generic
. Then, that line that I linked is skipped and 404/index.html
file is not checked.
In [1]: p = Project.objects.get(slug='cpython-devguide')
In [4]: v = p.versions.get(slug='1042')
In [5]: v.documentation_type
Out[5]: 'generic'
I are not checking for that file always to avoid hitting S3 API and extra time for all the requests. However, I suppose we may need to re-consider this since we have support for more doctools now, and I don't think we can keep making the same assumption. @ericholscher what do you think?
@humitos Yea, agreed. We likely need to be smarter here, but I really dislike adding more checks for this.
This is already solved in https://github.com/readthedocs/readthedocs.org/pull/9983 and it's going to be deploy today. Please, confirm this is working as you expected later today, or tomorrow 😄
It works now! 🥳
Brilliant, thank you for the quick fix!
Steps to reproduce
dirhtml
withnotfound_urls_prefix = "/"
for a single version site that is deployed at the root (i.e. no/en/latest/
)Actual result
Get the default maze:
Expected result
Get the custom 404 page.
More info
It seems that Read the Docs only supports a custom 404 page at
404.html
?https://docs.readthedocs.io/en/stable/hosting.html#custom-not-found-404-pages
And it looks like, with
dirhtml
, this extension builds the custom 404 page at404/index.html
, which Read the Docs ignores?For example, I can see custom 404 page (returning a 200) at:
https://cpython-devguide--1042.org.readthedocs.build/404/index.html
See also
https://github.com/python/devguide/pull/1042