-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Docs: unclear documentation about layout.js #60617
Comments
Just ran in this problem when trying to implement i18n on my site too. Additionally, this introduces a problem with the not-found.js. When we don't have app/layout.tsx, we get this error: not-found.tsx doesn't have a root layout. To fix this error, make sure every page has a root layout. And when you do put the root layout in the app dir, we get the problem where we need an html tag in app/[locale]/layout.tsx too - and that's where we need to have language parameters as an attribute to the html tag like mentioned above. |
@JasonA-work I am on version Another issue for me is that you can't have a navbar and footer on the 404 page, since they need i18n and mostlikly are used inside the |
@SmartMointy I'm on 14.1. Perhaps that's why. I finally found a solution that works from here: https://next-intl-docs.vercel.app/docs/environments/error-files Hope it becomes useful to you! To the Next JS team: @leerob Is it possible to include the information in your docs under the i18n topic? This is issue should be a common one and the solution to it is not straightforward. So having this in the docs will be very helpful. Thank you! |
@SmartMointy I don't think this is true now—I am seeing an error. Closing this since this is indeed required and and an error is showing. |
What is the improvement or update you wish to see?
Remove this line from layout.js docs under Root Layouts
app
directory must include a rootapp/layout.js
.Or provide a workaround on how to set
<html lang={params.lang}
inside aapp/[lang]/layout.js
Is there any context that might help us understand?
In the docs about layouts it says that:
app
directory must include a rootapp/layout.js
"<html>
and<body>
tags".Using next-intl or any similar i18n routing leads all pages being inside
app/[lang]
orapp/[locale]
.So if we have to put the root layout into the
app
folder we can't set<html lang={params.lang}>
since we can only access the locale inside theapp/[lang]/layout.js
file.Also having no
app/layout.js
works without any error or warning.Does the docs page already exist? Please link to it.
https://nextjs.org/docs/app/api-reference/file-conventions/layout
The text was updated successfully, but these errors were encountered: