@@ -5,12 +5,13 @@ import { Metadata } from 'next'
55export const generateStaticParams = generateStaticParamsFor ( 'mdxPath' )
66
77export async function generateMetadata ( props : {
8- params : Promise < { mdxPath : string [ ] } >
8+ params : Promise < { mdxPath ? : string [ ] } >
99} ) : Promise < Metadata > {
1010 const params = await props . params
11- const { metadata } = await importPage ( params . mdxPath )
12- const canonicalPath = params . mdxPath . length > 0
13- ? `/docs/${ params . mdxPath . join ( '/' ) } /`
11+ const mdxPath = params . mdxPath ?? [ ]
12+ const { metadata } = await importPage ( mdxPath )
13+ const canonicalPath = mdxPath . length > 0
14+ ? `/docs/${ mdxPath . join ( '/' ) } /`
1415 : '/docs/'
1516
1617 return {
@@ -29,10 +30,11 @@ export async function generateMetadata(props: {
2930const Wrapper = getMDXComponents ( ) . wrapper
3031
3132export default async function Page ( props : {
32- params : Promise < { mdxPath : string [ ] } >
33+ params : Promise < { mdxPath ? : string [ ] } >
3334} ) {
3435 const params = await props . params
35- const result = await importPage ( params . mdxPath )
36+ const mdxPath = params . mdxPath ?? [ ]
37+ const result = await importPage ( mdxPath )
3638 const { default : MDXContent , toc, metadata } = result
3739 return (
3840 < Wrapper toc = { toc } metadata = { metadata } >
0 commit comments