Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create language-specific 404 template #10400

Closed
jmau111 opened this issue Oct 27, 2022 · 4 comments
Closed

Cannot create language-specific 404 template #10400

jmau111 opened this issue Oct 27, 2022 · 4 comments

Comments

@jmau111
Copy link

jmau111 commented Oct 27, 2022

What version of Hugo are you using (hugo version)?

v0.104.3

Does this issue reproduce with the latest release?

yes

Description

It's not possible to use the folder pattern to have a different 404 per each language.

For example, layouts/404.html - layouts/404.zh.html won't work.

The only way I can make it work consists of using the i18n helper in a block:

{{ define "main" }}
{{ i18n "test" }}
{{ end }}

It's not very convenient, especially when your 404 layout needs another base template (usually much lighter than the global baseof).

My question is the following: is it something known and wanted?

@tyytytytyiigo
Copy link

It is a known issue. You need to use the i18n folder to translate 404 page (template). But here's to hoping that that will change soon.

@jmau111
Copy link
Author

jmau111 commented Nov 24, 2022

@jafaican hi, that would be a nice fix!

@jmooring jmooring changed the title Inconsistency in multilingual mode with 404 pages 404 template is not language aware May 6, 2023
@jmooring jmooring changed the title 404 template is not language aware Cannot create language-specific 404 template May 6, 2023
@jmooring
Copy link
Member

jmooring commented Apr 14, 2024

This was fixed with v0.123.0.

git clone --single-branch -b hugo-github-issue-10400 https://github.com/jmooring/hugo-testing hugo-github-issue-10400
cd hugo-github-issue-10400
hugo && tree public

Expected output:

public/
├── en/
│   ├── 404.html
│   └── index.html
├── fr/
│   ├── 404.html
│   └── index.html
└── index.html

Then run:

cat public/{en,fr}/404.html

Expected output:

layouts/404.en.html
layouts/404.fr.html

jmooring added a commit to jmooring/hugo-testing that referenced this issue Apr 14, 2024
jmooring added a commit to jmooring/hugo-testing that referenced this issue Apr 14, 2024
Copy link

github-actions bot commented May 6, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants