hinode icon indicating copy to clipboard operation
hinode copied to clipboard

[BUG] custom 404.html not in root

Open d-oit opened this issue 1 year ago • 1 comments

Describe the bug

any page who not found: https://demo.gethinode.com/en/gsfgsf

shows the server (netlify) and not the custom 404.html

Expected behavior

404.html in public folder

Screenshots

image

Host environment

Please complete the following information where applicable.

  • Hinode version: 0.26.7

d-oit avatar Sep 24 '24 06:09 d-oit

https://github.com/gohugoio/hugo/issues/5161

d-oit avatar Sep 24 '24 06:09 d-oit

Thanks for submitting a PR to fix this @d-oit! I've merged the changes with the main branch.

I've revised the server headers in v0.27-beta-3, so I'll include your remarks here: https://gethinode.com/docs/advanced-settings/server-headers/

markdumay avatar Oct 12 '24 13:10 markdumay

BTW, I adjusted the redirects from ** to * to improve compatibility with Netlify:

[[redirects]]
	from = '/fr/*'
	to = '/fr/404.html'
	status = 404

[[redirects]]
	from = '/nl/*'
	to = '/nl/404.html'
	status = 404

[[redirects]]
	from = '/en/*'
	to = '/en/404.html'
	status = 404

[[redirects]]  # Default language should be last.
	from = '/*'
	to = '/en/404.html'
	status = 404

markdumay avatar Oct 12 '24 15:10 markdumay

Hmm, I am confused.

I thought that this: https://github.com/gethinode/hinode/blob/main/netlify.toml for the hinode template.

That's why i create a pyhton script to copy https://github.com/gethinode/hinode/blob/main/netlify.toml to netlify.toml in the exampleSite to use this in netlify.toml for the exampleSite with the 404 custom.

Did see your last changes.

Forgot the annoying part of the Python copy script:

if 'from' in redirect: redirect['from'] = redirect['from'].replace('**', '*')

d-oit avatar Oct 12 '24 16:10 d-oit

I documented the configuration here: https://gethinode.com/docs/advanced-settings/server-headers/#configuring-custom-404-pages. Thanks again for your help @d-oit!

markdumay avatar Oct 12 '24 16:10 markdumay

I thought that this: https://github.com/gethinode/hinode/blob/main/netlify.toml for the hinode template.

It did, but I changed it in v0.27.0-beta3. You can now use data/server.toml and netlify.toml instead. The advantage being that the content security policies are now generated and synchronized automatically. See https://gethinode.com/docs/advanced-settings/server-headers/ for more details.

markdumay avatar Oct 13 '24 05:10 markdumay

you need a prompt or wizard for all the config 😄 great feature 👍🏻

d-oit avatar Oct 13 '24 13:10 d-oit

@markdumay here i my playwright test if you needed https://github.com/d-oit/d-oit.github.io/blob/main/tests/tests-custom404/showCustom404.spec.js

d-oit avatar Oct 13 '24 14:10 d-oit