generateStaticParams
The variants to prerender, ready to export from a layout or page.
indicators.generateStaticParams(): { locale: string; prefs: string; flags: string }[]
indicators.locale.generateStaticParams(): { locale: string }[]
indicators.prefs.generateStaticParams(): { prefs: string }[]
indicators.flags.generateStaticParams(): { flags: string }[]
See Static generation for where each belongs.
// app/[locale]/[prefs]/[flags]/layout.tsx
export const generateStaticParams = indicators.generateStaticParams
The combined form lists every locale against every preference segment against every flag segment. The per-level forms list one segment each, for a layout at that level.
What a segment list holds
Each prerendered indicator is either absent or at one of its values, in every combination, sorted so the empty segment comes first:
// prefs: theme (light, dark), tz (EST)
[{ prefs: '-' }, { prefs: 'tz~EST' }, { prefs: 'theme~light' }, { prefs: 'theme~light.tz~EST' }, …]
An indicator's prerender decides which of its values are listed — all,
none, or the common ones — and whatever is left out renders on demand and
is cached; see Static generation. An app that wants a
different set still writes its own function and uses
encode to spell the segments.