tomy0000000 / blog

✍🏻 Tomy Hsieh's marvelous blog, open sourced 🪐
https://blog.tomy.me/
1 stars 0 forks source link

404 Page is not used #10

Open tomy0000000 opened 1 year ago

tomy0000000 commented 1 year ago

The 404.html gets created for each language directory, such as zh-tw/404.html and en/404.html, but GitHub Pages require custom 404.html to be located in the root directory, which is not compatible when defaultContentLanguageInSubdir: true is set in Hugo, see gohugoio/hugo#5161.

Also, the 404 page is always shown in the default language, even when the English 404 page is generated.

anasfanani commented 8 months ago

I think we can use custom route by cloudflare

tomy0000000 commented 8 months ago

I think we can use custom route by cloudflare

Thanks for your suggestion, but I'd lean toward having this problem fixed at Hugo instead of Monkey Patch.

anasfanani commented 8 months ago

Thanks for your suggestion, but I'd lean toward having this problem fixed at Hugo instead of Monkey Patch.

AFAIK, github cant use 404.html in subdirectory, the en/404.html is still exists but cannot use for github pages, in order to use 404 html in multilingual we need generate a custom 404.html inside folder static/404.html, in the custom 404.html I need to route redirect based on localstorage of language, this is to much and I doesnt have any idea again.

If using cloudflare we can use transform rule or redirect rule.

tomy0000000 commented 8 months ago

Thanks for your suggestion, but I'd lean toward having this problem fixed at Hugo instead of Monkey Patch.

AFAIK, github cant use 404.html in subdirectory, the en/404.html is still exists but cannot use for github pages, in order to use 404 html in multilingual we need generate a custom 404.html inside folder static/404.html, in the custom 404.html I need to route redirect based on localstorage of language, this is to much and I doesnt have any idea again.

If using cloudflare we can use transform rule or redirect rule.

Yes, I do understand, but I'd wait for Hugo to solve this issue instead of tampering with this on the server side.