Next.js Discord

Discord Forum

generateStaticParams

Unanswered
Little Curlew posted this in #help-forum
Open in Discord
Avatar
Little CurlewOP
Hello,

I am trying to use differente locales in my actual project, followed Next doc + their example https://github.com/vercel/next.js/blob/canary/examples/app-dir-i18n-routing/

My getStaticParams is called, but rootLayout does receive nothing from it, the underlying problem is that it forces then to have only SSR and no SSG pages.

I used a workaround, by calling getStaticParams in a layout in /[lang], but it is redondant and i still get incorrect html with no lang attribute.
Image
Image

7 Replies

Avatar
Little CurlewOP
As you can see, in [lang] Layout getStaticParams works fine
Image
Avatar
joulev
you cannot access a param in upper layouts. for this i did have a prototype the other day that worked https://discord.com/channels/752553802359505017/766433464055496744/1125774882387525672 you can have a look
Avatar
Little CurlewOP
It’s what i figured out but that’s really weird as it’s what the actual doc example does …
Avatar
joulev
in the official doc example, they have several root layouts
app/
  [lang]/
    layout.tsx <- root layout
    page.tsx

there is no app/layout.tsx
that's why it works
Avatar
Little CurlewOP
Ow you can do that ??? That’s my bad then
Thanks a lot i will try this out