@@ -10,11 +10,11 @@ export default async function BlogPost({
1010 params : Promise < { slug : string } > ;
1111} ) {
1212 const { slug } = await params ;
13- const post = blog . find ( ( post : any ) => post . slug === slug ) as any ;
13+ const post = blog . find ( ( post : any ) => post . info . path . replace ( / \. m d x ? $ / , '' ) === slug ) as any ;
1414
1515 if ( ! post ) notFound ( ) ;
1616
17- const MDX = post . data . body ;
17+ const MDX = post . body ;
1818
1919 return (
2020 < HomeLayout
@@ -35,15 +35,15 @@ export default async function BlogPost({
3535 < article className = "container mx-auto max-w-3xl px-6 py-12" >
3636 < header className = "mb-12 text-center" >
3737 < div className = "mb-4 text-sm text-fd-muted-foreground" >
38- < time > { new Date ( post . data . date ) . toLocaleDateString ( ) } </ time >
39- { post . data . author && < span > • { post . data . author } </ span > }
38+ < time > { new Date ( post . date ) . toLocaleDateString ( ) } </ time >
39+ { post . author && < span > • { post . author } </ span > }
4040 </ div >
4141 < h1 className = "text-4xl font-bold leading-tight md:text-5xl" >
42- { post . data . title }
42+ { post . title }
4343 </ h1 >
44- { post . data . description && (
44+ { post . description && (
4545 < p className = "mt-6 text-xl text-fd-muted-foreground" >
46- { post . data . description }
46+ { post . description }
4747 </ p >
4848 ) }
4949 </ header >
@@ -57,8 +57,8 @@ export default async function BlogPost({
5757}
5858
5959export function generateStaticParams ( ) {
60- return blog . map ( ( post ) => ( {
61- slug : post . slug ,
60+ return blog . map ( ( post : any ) => ( {
61+ slug : post . info . path . replace ( / \. m d x ? $ / , '' ) ,
6262 } ) ) ;
6363}
6464
@@ -68,10 +68,10 @@ export async function generateMetadata({
6868 params : Promise < { slug : string } >
6969} ) {
7070 const { slug } = await params ;
71- const post = blog . find ( ( post ) => post . slug === slug ) ;
71+ const post = blog . find ( ( post : any ) => post . info . path . replace ( / \. m d x ? $ / , '' ) === slug ) as any ;
7272 if ( ! post ) return ;
7373 return {
74- title : post . data . title ,
75- description : post . data . description ,
74+ title : post . title ,
75+ description : post . description ,
7676 } ;
7777}
0 commit comments