Opened 3 years ago

Last modified 3 years ago

#17113 new bug

relativeURLs breaking logo in 404 page

Reported by: kallisti5 Owned by: waddlesplash
Priority: normal Milestone:
Component: Website/www.haiku-os.org Version:
Keywords: 404 hugo netlify Cc:
Blocked By: Blocking: #16280, #16426
Platform: All

Description (last modified by kallisti5)

relativeURLs = true

that is set in our hugo.toml, and appears to be causing a breakage of loading the 404 page's contents on netlify (see logo on 404 page for an example)

https://answers.netlify.com/t/slash-breaks-relative-urls-in-404-page/10248

We should see if we can solve the breakage without disabling relativeURL first.

Example:

Doesn't work: https://www.haiku-os.org/get-haiku/r1beta100

Works: https://www.haiku-os.org/get-heku

Change History (6)

comment:1 by kallisti5, 3 years ago

Description: modified (diff)

comment:2 by kallisti5, 3 years ago

Description: modified (diff)

comment:3 by kallisti5, 3 years ago

Description: modified (diff)

comment:4 by madmax, 3 years ago

Not only logo but all processed links, like the ones in the navbar.

https://github.com/gohugoio/hugo/issues/1555#issuecomment-280851562

So it doesn't look like it's possible from hugo's point of view. It is just generating files for a static site. If the links are relative to the content file and that content is served from different path levels...

We could include <base href="/"> in the 404 page, but that defeats the reason to have urls relative to content, as that page wouldn't work if the site was copied below the domain root.

Another thing that might work would be adding something like this to the end of _redirects:

/not-found  /404.html   404
/*          /not-found  302

The first rule would dispatch the 404 page when not-found is requested. 404 code does not rewrite the URL. The second rule would redirect any request without a correspoding file (or previous rule) to /not-found. But this is hacky at best, I can't test it and I don't know how it would work when deployed below the root directory (though if it breaks, the other rules that are currently there would break too).

comment:5 by waddlesplash, 3 years ago

Blocking: 16280 added

comment:6 by waddlesplash, 3 years ago

Blocking: 16426 added
Note: See TracTickets for help on using tickets.