File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,12 +9,17 @@ import {getMDXComponent} from 'next-contentlayer/hooks';
99import { notFound } from 'next/navigation' ;
1010import { Suspense } from 'react' ;
1111
12- export const maxDuration = 300 ;
12+ // Every page is enumerated by generateStaticParams. Reject unknown slugs at the
13+ // router so the site returns a real HTTP 404. Without this, notFound() runs
14+ // inside the root layout's <Suspense> after the response has started streaming,
15+ // and the not-found page is served with status 200.
16+ export const dynamicParams = false ;
1317
1418export const generateStaticParams = async ( ) => {
15- return allPosts . map ( post => ( {
16- params : { slug : post . _raw . flattenedPath . split ( '/' ) }
17- } ) ) ;
19+ return allPosts
20+ // The root document is served by app/page.tsx, not this catch-all route.
21+ . filter ( post => post . _raw . flattenedPath !== '' )
22+ . map ( post => ( { slug : post . _raw . flattenedPath . split ( '/' ) } ) ) ;
1823} ;
1924
2025export const generateMetadata = ( { params} : Props ) => {
You can’t perform that action at this time.
0 commit comments