1- import  {  source  }  from  ' @/lib/source' ; 
1+ import  {  source  }  from  " @/lib/source" ; 
22import  { 
33  DocsPage , 
44  DocsBody , 
55  DocsDescription , 
66  DocsTitle , 
7- }  from  'fumadocs-ui/page' ; 
8- import  {  notFound  }  from  'next/navigation' ; 
9- import  {  createRelativeLink  }  from  'fumadocs-ui/mdx' ; 
10- import  {  getMDXComponents  }  from  '@/mdx-components' ; 
7+ }  from  "fumadocs-ui/page" ; 
8+ import  {  notFound  }  from  "next/navigation" ; 
9+ import  {  createMetadata ,  generateStructuredData ,  siteConfig  }  from  "@/lib/seo" ; 
10+ import  { 
11+   getLastModifiedFromUrl , 
12+   getCreatedFromUrl , 
13+   getAuthorFromUrl , 
14+ }  from  "@/lib/git" ; 
15+ import  {  Metadata  }  from  "next" ; 
16+ import  LastModified  from  "@/components/mdx/last-modified" ; 
17+ import  {  getMDXComponents  }  from  "@/mdx-components" ; 
1118
1219export  default  async  function  Page ( props : { 
1320  params : Promise < {  slug ?: string [ ]  } > ; 
@@ -16,19 +23,34 @@ export default async function Page(props: {
1623  const  page  =  source . getPage ( params . slug ) ; 
1724  if  ( ! page )  notFound ( ) ; 
1825
19-   const  MDXContent  =  page . data . body ; 
26+   const  MDX  =  page . data . body ; 
27+ 
28+   const  lastModified  =  await  getLastModifiedFromUrl ( page . url ) ; 
29+   const  datePublished  =  await  getCreatedFromUrl ( page . url ) ; 
30+   const  author  =  await  getAuthorFromUrl ( page . url ) ; 
31+ 
32+   const  structuredData  =  generateStructuredData ( "article" ,  { 
33+     title : page . data . title , 
34+     description : page . data . description  ||  siteConfig . description , 
35+     url : `${ siteConfig . url } ${ page . url }  ` , 
36+     datePublished, 
37+     dateModified : lastModified , 
38+     author, 
39+   } ) ; 
2040
2141  return  ( 
22-     < DocsPage  toc = { page . data . toc }  full = { page . data . full }  tableOfContent = { { style : "clerk" } }  tableOfContentPopover = { { style : "clerk" } } > 
42+     < DocsPage  toc = { page . data . toc }  full = { page . data . full } > 
43+       < script 
44+         type = "application/ld+json" 
45+         dangerouslySetInnerHTML = { { 
46+           __html : JSON . stringify ( structuredData ) , 
47+         } } 
48+       /> 
2349      < DocsTitle > { page . data . title } </ DocsTitle > 
2450      < DocsDescription > { page . data . description } </ DocsDescription > 
2551      < DocsBody > 
26-         < MDXContent 
27-           components = { getMDXComponents ( { 
28-             // this allows you to link to other pages with relative file paths 
29-             a : createRelativeLink ( source ,  page ) , 
30-           } ) } 
31-         /> 
52+         < MDX  components = { getMDXComponents ( ) }  /> 
53+         < LastModified  date = { lastModified }  author = { author }  /> 
3254      </ DocsBody > 
3355    </ DocsPage > 
3456  ) ; 
@@ -40,13 +62,15 @@ export async function generateStaticParams() {
4062
4163export  async  function  generateMetadata ( props : { 
4264  params : Promise < {  slug ?: string [ ]  } > ; 
43- } )  { 
65+ } ) :  Promise < Metadata >  { 
4466  const  params  =  await  props . params ; 
4567  const  page  =  source . getPage ( params . slug ) ; 
4668  if  ( ! page )  notFound ( ) ; 
4769
48-   return  { 
49-     title : page . data . title , 
50-     description : page . data . description , 
51-   } ; 
70+   return  createMetadata ( 
71+     page . data . title , 
72+     page . data . description , 
73+     undefined , 
74+     page . url 
75+   ) ; 
5276} 
0 commit comments