My 404 page ignores my (null) baseURL - and makes everything relative to the baseURL of the (faulty) link.
Example:
https://pages.graphics.cs.wisc.edu/VisSnacks/bleet - works correctly
https://pages.graphics.cs.wisc.edu/VisSnacks/bleet/ - doesn’t work correctly because it uses the baseURL of “bleet/” and tries to access everything (such as the CSS) as being in the /bleet/ directory
If you want to see the source code: GitHub - uwgraphics/VisSnacks: Hugo Site for the VisSnacks project - this is the public facing page
Explanation:
My site uses relative URLs (this is based on superstition from years of using Hugo - it’s in my hugo.toml):
baseURL = ""
relativeURLs = true
canonifyURLs = true
enableGitInfo = true
Everything works fine, except the 404 page.
The 404 page is OK if the link is to the root directory, so https://pages.graphics.cs.wisc.edu/VisSnacks/bleet does the right thing (the relative link to the CSS is relative to the site root)
But, if the 404 page link is not in the root directory, things don’t work, so if I try https://pages.graphics.cs.wisc.edu/VisSnacks/bleet/blat, its as if the baseURL got changed to “/bleet/” (so it can find the CSS and other things because it is looking in “https://pages.graphics.cs.wisc.edu/VisSnacks/bleet/” rather than “//pages.graphics.cs.wisc.edu/VisSnacks/”
This only seems to be a problem for the 404 page. The 404 page itself has correct relative links, but somehow the browser is telling it to do something different. I think this is because it is doing things relative to the link (rather than relative to the 404 page).
Is there an easy fix for this? Can I put a base tag on the 404 page?
(a non-easy fix would be to switch to using baseURL and absolute links for the whole site, which I prefer not to do - but I don’t have a good reason).
And a minor annoyance… the 404 page seems to not get the correct date stamp from GitHub for its creation date.