Skip to content

generateStaticParams missing on dynamic route

Without generateStaticParams(), Next.js does not know which paths exist at build time. Pages are rendered on demand without static optimisations, or simply not built at all if the route cannot fall back to server rendering.

Export generateStaticParams() from the route file. It returns an array of param objects matching the route’s dynamic segments.

app/blog/[slug]/page.tsx
export async function generateStaticParams() {
const posts = await getPosts()
return posts.map(post => ({ slug: post.slug }))
}
export default async function Page({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params
const post = await getPost(slug)
return <article><h1>{post.title}</h1></article>
}

If the route content is fully dynamic — for example, a user-specific dashboard — pre-rendering is not possible. Export force-dynamic instead.

export const dynamic = 'force-dynamic'

Run next build and check the output. Routes with generateStaticParams() appear as ○ (Static) or ● (SSG). Re-run orino audit to clear the flag.