File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ import { source } from "@/lib/source" ;
2+ import { getMDXComponents } from "@/mdx-components" ;
3+ import { createRelativeLink } from "fumadocs-ui/mdx" ;
4+ import { DocsBody , DocsDescription , DocsPage , DocsTitle } from "fumadocs-ui/page" ;
5+ import { notFound } from "next/navigation" ;
6+
7+ export default async function Page ( props : { params : Promise < { slug ?: string [ ] } > } ) {
8+ const params = await props . params ;
9+ const page = source . getPage ( params . slug ) ;
10+ if ( ! page ) notFound ( ) ;
11+
12+ const MDXContent = page . data . body ;
13+
14+ return (
15+ < DocsPage toc = { page . data . toc } full = { page . data . full } >
16+ < DocsTitle > { page . data . title } </ DocsTitle >
17+ < DocsDescription > { page . data . description } </ DocsDescription >
18+ < DocsBody >
19+ < MDXContent
20+ components = { getMDXComponents ( {
21+ // this allows you to link to other pages with relative file paths
22+ a : createRelativeLink ( source , page )
23+ } ) }
24+ />
25+ </ DocsBody >
26+ </ DocsPage >
27+ ) ;
28+ }
29+
30+ export async function generateStaticParams ( ) {
31+ return source . generateParams ( ) ;
32+ }
33+
34+ export async function generateMetadata ( props : { params : Promise < { slug ?: string [ ] } > } ) {
35+ const params = await props . params ;
36+ const page = source . getPage ( params . slug ) ;
37+ if ( ! page ) notFound ( ) ;
38+
39+ return {
40+ title : page . data . title ,
41+ description : page . data . description
42+ } ;
43+ }
You can’t perform that action at this time.
0 commit comments