66 * LICENSE file in the root directory of this source tree.
77 */
88
9- import { source } from '@/lib/source' ;
9+ import { getPageImage , source } from '@/lib/source' ;
10+ import { DocsBody , DocsDescription , DocsPage , DocsTitle } from 'fumadocs-ui/layouts/docs/page' ;
1011import type { Metadata } from 'next' ;
11- import { DocsPage , DocsBody } from 'fumadocs-ui/page' ;
1212import { notFound } from 'next/navigation' ;
13+ import { getMDXComponents } from '@/mdx-components' ;
14+ import { createRelativeLink } from 'fumadocs-ui/mdx' ;
1315import { siteConfig } from '@/lib/site-config' ;
14- import defaultComponents from 'fumadocs-ui/mdx' ;
15- import { Callout } from 'fumadocs-ui/components/callout' ;
16- import { Card , Cards } from 'fumadocs-ui/components/card' ;
17- import { Steps , Step } from 'fumadocs-ui/components/steps' ;
18-
19- const components = {
20- ...defaultComponents ,
21- Callout,
22- Card,
23- Cards,
24- Steps,
25- Step,
26- } ;
2716
2817interface PageProps {
2918 params : Promise < {
@@ -41,26 +30,25 @@ export default async function Page({ params }: PageProps) {
4130 notFound ( ) ;
4231 }
4332
44- const MDX = page . data . body as any ;
33+ const MDX = page . data . body ;
4534
4635 return (
47- < DocsPage
48- toc = { page . data . toc as any }
49- full = { page . data . full as any }
50- lastUpdate = { siteConfig . page . showLastUpdate ? ( page . data as any ) . lastModified : undefined }
36+ < DocsPage
37+ toc = { page . data . toc }
38+ full = { page . data . full }
5139 tableOfContent = { {
5240 enabled : siteConfig . layout . toc . enabled ,
5341 style : siteConfig . layout . toc . depth > 2 ? 'clerk' : 'normal' ,
5442 } }
55- editOnGithub = { siteConfig . page . showEditLink ? {
56- owner : siteConfig . page . repoBaseUrl . split ( '/' ) [ 3 ] ,
57- repo : siteConfig . page . repoBaseUrl . split ( '/' ) [ 4 ] ,
58- sha : 'main' , // Defaulting to main, could be extracted
59- path : siteConfig . page . repoBaseUrl . split ( '/' ) . slice ( 7 ) . join ( '/' ) // simplistic parsing
60- } : undefined }
6143 >
44+ < DocsTitle > { page . data . title } </ DocsTitle >
45+ < DocsDescription > { page . data . description } </ DocsDescription >
6246 < DocsBody >
63- < MDX components = { components } />
47+ < MDX
48+ components = { getMDXComponents ( {
49+ a : createRelativeLink ( source , page ) ,
50+ } ) }
51+ />
6452 </ DocsBody >
6553 </ DocsPage >
6654 ) ;
@@ -80,5 +68,8 @@ export async function generateMetadata({ params }: PageProps): Promise<Metadata>
8068 return {
8169 title : page . data . title ,
8270 description : page . data . description ,
71+ openGraph : {
72+ images : getPageImage ( page ) . url ,
73+ } ,
8374 } ;
8475}
0 commit comments