Hi,
The issue is that the customized 404 page is not displayed depending on “defaultContentLanguageInSubdir” setting
To http://localhost:1313/404.html
if true , you get a “404 page not found” blank page
if false , you get the customized 404 page
I made a simple test with the Quick start | Hugo method
to which I added the main config files I have , in order to reproduce the problem.
This test is on GitHub - Productivix/quickstart: site de test Hugo multilingue for tests purposes via a git clone.
The command “hugo server” gives on a linux machine :
hugo v0.120.4-f11bca5fec2ebb3a02727fb2a5cfb08da96fd9df+extended linux/amd64 BuildDate=2023-11-08T11:18:07Z VendorInfo=snap:0.120.4
| FR | EN | IT | DE
-------------------+----+----+----+-----
Pages | 11 | 10 | 7 | 10
Paginator pages | 0 | 0 | 0 | 0
Non-page files | 0 | 0 | 0 | 0
Static files | 1 | 1 | 1 | 1
Processed images | 0 | 0 | 0 | 0
Aliases | 2 | 1 | 0 | 1
Sitemaps | 2 | 1 | 1 | 1
Cleaned | 0 | 0 | 0 | 0
Built in 121 ms
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Thank you .
I must add a very important fact :
this test has an issue on :
this test is not an issue on sudo linux machine !
May be a 404 signal not issued by the HUGO server or a config error ?
I summarized three workarounds in a blog post.
If you build a multilangual Hugo site, you may want to enable defaultContentLanguageInSubdir to make URLs look consistent. For example: /en/post/an-english-post /cn/post/a-chinese-post As of Hugo v0.120.4, defaultContentLanguageInSubdir = "true"...
1 Like
Thank you very much @CyrusYip ! I choose your 2nd solution : in fact a 404.lang.md where “lang” is the default site language with the url parameter in the top is the best solution .
I publish the web site and the repo with the solution, thanks again !
Arif
December 1, 2023, 3:40pm
5
If you build a multilangual Hugo site, you may want to enable defaultContentLanguageInSubdir
to make URLs look consistent.
You need to add more details to this as it only applies if the user wants the default language in a subdirectory. Some users (like me) ran the default language in the root directory, so that setting is irrelevant.
I think the first two paragraphs (including URL examples) imply this. After reading those paragraphs, readers should know if they need to continue.
Arif
December 1, 2023, 8:10pm
8
Make it explicit! Don’t leave it up to the reader to assume the intended meaning.
Thanks for your advice, I will add " You don’t need these workarounds if you don’t enable defaultContentLanguageInSubdir
." to the post.
system
Closed
December 4, 2023, 6:26am
10
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.