Bug 439641

Summary: Docs 404 page broken when path not at top level
Product: [Applications] krita Reporter: Alvin Wong <alvin>
Component: DocumentationAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: griffinvalley
Priority: NOR    
Version First Reported In: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alvin Wong 2021-07-08 12:18:09 UTC
The 404 page doesn't load properly if the URL is deeper than the root, like https://docs.krita.org/en/user_manual/this-does-not-exist.html

None of the styles, images and scripts are loaded. The search box and language switch also does not work as a result.
Comment 1 wolthera 2021-07-08 12:22:34 UTC
how weird... Looks like the paths get messed up :|
Comment 2 Alvin Wong 2021-07-08 15:26:42 UTC
I think it's because the 404 page is built assuming it would be located at https://docs.krita.org/en/404.html and it uses relative paths to reference stuff, which wouldn't work when the page is loaded for deeper directories. One way to fix it would be to inject a <base> tag [1] into the generated 404.html to make it load relative to https://docs.krita.org/[LANG]/ .

[1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
Comment 3 Alvin Wong 2021-07-09 06:34:15 UTC
So someone actually made a whole plugin for this, but it seems slightly overkill?

https://github.com/readthedocs/sphinx-notfound-page