Bug 439641 - Docs 404 page broken when path not at top level
Summary: Docs 404 page broken when path not at top level
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Documentation (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-08 12:18 UTC by Alvin Wong
Modified: 2021-07-17 07:19 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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