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
bugok
changed the title
Non-existent two-part path results with 404 page which doesn't load css and js files
Non-existent two-part path results with 404 page which doesn't load css and js files when using relativeURLs: true
May 7, 2024
The path begins with ./, so it is relative to the current page. It is not relative to the directory from which the assets are served. There's no way that will work.
What version of Hugo are you using (
hugo version
)?0.124.1
Does this issue reproduce with the latest release?
I'm not sure. It's hard to reproduce locally.
More information
When accessing a two-level, non existent path of a website, css and js files don't load.
Accessing my website at https://www.noamlerner.com works great.
Accessing https://www.noamlerner.com/nonexistent results with a 404 with a page which can load the css and js files.
However, accessing https://www.noamlerner.com/nonexistent/another results with a 404 response, but css and js files can't load.
Looking at the developer tools console I see that the static content is trying to be retrieved from: https://www.noamlerner.com/nonexistent/. For example:
For context, I am using the relativeURLs: true option in my hugo config. You can see in this discussion why: jpanther/congo#857.
Furthermore, I tried reproducing this with other random hugo websites I found, and got 3/3:
I searched github for websites which use
relativeURLs
: https://github.com/search?q=%22relativeURLs%3A+true%22+path%3A%2F%5Econfig%5C.yaml%2F&type=codeExamples:
All of them showed with the same behavior - when loading the a two-part, non-existent path - the 404 page can't load static content.
The text was updated successfully, but these errors were encountered: