Functions

Pages getStaticPaths

Pages Router dynamic static pages use getStaticPaths alongside getStaticProps. false limits the route to listed paths; true can show a fallback during a direct initial request but client navigation may behave like blocking; blocking generates the page before responding. Not an authorization boundary; validate the slug and return notFound for absent records. Fallback modes requiring runtime generation are not for static export. Source: https://nextjs.org/docs/pages/api-reference/functions/get-static-paths. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.

Formal Syntax & Structure

nextjs syntaxnextjs
export const getStaticPaths: GetStaticPaths = async () => ...

Working Example

Example Snippetnextjs
// pages/catalog/[slug].tsximport type { GetStaticPaths, GetStaticProps, InferGetStaticPropsType } from 'next';const titles:Record<string,string> = {'fern-atlas':'Fern Atlas','river-walk':'River Walk'};export const getStaticPaths = (async () => ({paths:[{params:{slug:'fern-atlas'}}],fallback:'blocking'})) satisfies GetStaticPaths;export const getStaticProps = (async ({params}) => { const slug=params?.slug; if(typeof slug!=='string'||!Object.hasOwn(titles,slug)) return {notFound:true}; return {props:{title:titles[slug]},revalidate:120};}) satisfies GetStaticProps<{title:string}>;export default function Book({title}:InferGetStaticPropsType<typeof getStaticProps>){return <main><h1>{title}</h1></main>;}
Next.js Reference