Next.js Discord

Discord Forum

how work generateStaitcParams with sub dynamic routes?

Unanswered
Somali posted this in #help-forum
Open in Discord
SomaliOP
hello
i have this structure:
app
 [lang]
   [slug]
     page.js


should i use generateStaticParams inside root layout for [lang] and [slug]? or only for langs and call another generateStaticParams inside [slug]/page.js?

11 Replies

site is in production, no problems. seems to pre-render well
@Northeast Congo Lion I have done it on page.js for generateStaticParams and it works ok
SomaliOP
do you have root page.js for home page?
so moving the generateStaticParams to pages might end up being mandatory anyway if afterwards you add a dynamic page under the same layout
PPR might change the game though
The State of JavaScript survey open source codebase if you want to see a real-life app
note that many generateStaticParams are commented out due to various weird bugs we had... 14.1 might be more stable when released