generateStaticParamsFor
Function
Generates static parameters based on your content
directory structure.
This helper function is designed to work with Next.js’ generateStaticParams
function to create
static paths for all your MDX/Markdown pages.
Exported from nextra/pages
.
Signature
Parameters:Name | Type | Default |
---|---|---|
segmentKey | string The name of your catch-all route segment (e.g., | |
localeSegmentKey | string The name of the locale segment when you have i18n. | "lang" |
() => Promise<{ [x: string]: string | string[]; }[]>
A function that generates an array of parameters for static page generation.
Example
Basic usage with a catch-all route
// app/[[...slug]]/page.tsx
export const generateStaticParams = generateStaticParamsFor('slug')
Usage with i18n support
// app/[locale]/[[...mdxPath]]/page.tsx
export const generateStaticParams = generateStaticParamsFor('mdxPath', 'locale')