jpanther / congo

A powerful, lightweight theme for Hugo built with Tailwind CSS.
https://jpanther.github.io/congo/
MIT License
1.19k stars 313 forks source link

Non-existent two-part path results with 404 page which doesn't load css and js files #873

Closed bugok closed 4 months ago

bugok commented 4 months ago

Issue description

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:

https://www.noamlerner.com/nonexistent/css/main.bundle.min.5ea5a2723a6600ec162c3206366e9a4fbb0c82f79711e724dea2dfe92a2a864f.css
https://www.noamlerner.com/nonexistent/site.webmanifest

For context, I am using the relativeURLs: true option in my hugo config. You can see in this discussion why: https://github.com/jpanther/congo/discussions/857.

Theme version

v2.8.1

Hugo version

hugo v0.125.3-474c4c02212cf97712c6fbf4159c68822ea6e078+extended darwin/arm64 BuildDate=2024-04-22T17:18:35Z VendorInfo=brew

Which browser rendering engines are you seeing the problem on?

Chromium (Google Chrome, Microsoft Edge, Brave, Vivaldi, Opera, etc.)

URL to sample repository or website

https://www.noamlerner.com/ldsjfkdsjfn/sldjfkdsjb

Hugo output or build error messages

Not relevant.
bugok commented 4 months ago

I think this might be a hugo bug, related to the usage of relativeURLs. 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=code

Examples:

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.

bugok commented 4 months ago

Opened https://github.com/gohugoio/hugo/issues/12471