1+ import type { DocData , DocMethods } from "fumadocs-mdx/runtime/types" ;
12import { DocsBody , DocsPage , DocsTitle } from "fumadocs-ui/page" ;
23import type { Metadata } from "next" ;
34import { notFound } from "next/navigation" ;
@@ -7,6 +8,12 @@ import { onRateDocs } from "@/lib/feedback-action";
78import { getPageImage , source } from "@/lib/source" ;
89import { getMDXComponents } from "@/mdx-components" ;
910
11+ type AsyncPageData = DocMethods & {
12+ title ?: string ;
13+ description ?: string ;
14+ load : ( ) => Promise < DocData > ;
15+ } ;
16+
1017export default async function Page ( props : {
1118 params : Promise < { slug ?: string [ ] } > ;
1219} ) {
@@ -16,7 +23,8 @@ export default async function Page(props: {
1623 notFound ( ) ;
1724 }
1825
19- const MDX = await page . data . body ;
26+ const pageData = page . data as AsyncPageData ;
27+ const { body : MDX , toc } = await pageData . load ( ) ;
2028
2129 return (
2230 < DocsPage
@@ -30,11 +38,10 @@ export default async function Page(props: {
3038 component : < DocsFooter /> ,
3139 enabled : true ,
3240 } }
33- full = { page . data . full }
3441 tableOfContent = { {
3542 style : "clerk" ,
3643 } }
37- toc = { page . data . toc }
44+ toc = { toc }
3845 >
3946 < DocsTitle > { page . data . title } </ DocsTitle >
4047 < DocsBody >
@@ -58,15 +65,16 @@ export async function generateMetadata(props: {
5865 notFound ( ) ;
5966 }
6067
68+ const pageTitle = page . data . title ?? "Documentation" ;
6169 const url = `https://www.databuddy.cc${ page . url } ` ;
62- const title = `${ page . data . title } | Databuddy Documentation` ;
70+ const title = `${ pageTitle } | Databuddy Documentation` ;
6371 const description =
64- page . data . description ||
65- `Learn about ${ page . data . title } in Databuddy's privacy-first analytics platform. Complete guides and API documentation.` ;
72+ page . data . description ??
73+ `Learn about ${ pageTitle } in Databuddy's privacy-first analytics platform. Complete guides and API documentation.` ;
6674 const ogImage = `https://www.databuddy.cc${ getPageImage ( page ) . url } ` ;
6775
6876 const baseKeywords = [
69- page . data . title . toLowerCase ( ) ,
77+ pageTitle . toLowerCase ( ) ,
7078 "databuddy" ,
7179 "analytics" ,
7280 "privacy-first" ,
@@ -125,7 +133,7 @@ export async function generateMetadata(props: {
125133 url : ogImage ,
126134 width : 1200 ,
127135 height : 630 ,
128- alt : `${ page . data . title } - Databuddy Documentation` ,
136+ alt : `${ pageTitle } - Databuddy Documentation` ,
129137 } ,
130138 ] ,
131139 } ,
@@ -156,7 +164,7 @@ export async function generateMetadata(props: {
156164 } ,
157165 other : {
158166 "article:section" : "Documentation" ,
159- "article:tag" : page . data . title ,
167+ "article:tag" : pageTitle ,
160168 "article:author" : "Databuddy Team" ,
161169 "og:site_name" : "Databuddy Documentation" ,
162170 } ,
0 commit comments