1+ import type React from 'react'
12import { findNeighbour } from 'fumadocs-core/page-tree'
23import defaultMdxComponents from 'fumadocs-ui/mdx'
34import { DocsBody , DocsDescription , DocsPage , DocsTitle } from 'fumadocs-ui/page'
@@ -10,14 +11,15 @@ import { LLMCopyButton } from '@/components/page-actions'
1011import { StructuredData } from '@/components/structured-data'
1112import { CodeBlock } from '@/components/ui/code-block'
1213import { Heading } from '@/components/ui/heading'
13- import { source } from '@/lib/source'
14+ import { type PageData , source } from '@/lib/source'
1415
1516export default async function Page ( props : { params : Promise < { slug ?: string [ ] ; lang : string } > } ) {
1617 const params = await props . params
1718 const page = source . getPage ( params . slug , params . lang )
1819 if ( ! page ) notFound ( )
1920
20- const MDX = page . data . body
21+ const data = page . data as PageData
22+ const MDX = data . body
2123 const baseUrl = 'https://docs.sim.ai'
2224
2325 const pageTreeRecord = source . pageTree as Record < string , any >
@@ -51,7 +53,7 @@ export default async function Page(props: { params: Promise<{ slug?: string[]; l
5153
5254 if ( index === urlParts . length - 1 ) {
5355 breadcrumbs . push ( {
54- name : page . data . title ,
56+ name : data . title ,
5557 url : `${ baseUrl } ${ page . url } ` ,
5658 } )
5759 } else {
@@ -168,15 +170,15 @@ export default async function Page(props: { params: Promise<{ slug?: string[]; l
168170 return (
169171 < >
170172 < StructuredData
171- title = { page . data . title }
172- description = { page . data . description || '' }
173+ title = { data . title }
174+ description = { data . description || '' }
173175 url = { `${ baseUrl } ${ page . url } ` }
174176 lang = { params . lang }
175177 breadcrumb = { breadcrumbs }
176178 />
177179 < DocsPage
178- toc = { page . data . toc }
179- full = { page . data . full }
180+ toc = { data . toc }
181+ full = { data . full }
180182 breadcrumb = { {
181183 enabled : false ,
182184 } }
@@ -207,20 +209,32 @@ export default async function Page(props: { params: Promise<{ slug?: string[]; l
207209 </ div >
208210 < PageNavigationArrows previous = { neighbours ?. previous } next = { neighbours ?. next } />
209211 </ div >
210- < DocsTitle > { page . data . title } </ DocsTitle >
211- < DocsDescription > { page . data . description } </ DocsDescription >
212+ < DocsTitle > { data . title } </ DocsTitle >
213+ < DocsDescription > { data . description } </ DocsDescription >
212214 </ div >
213215 < DocsBody >
214216 < MDX
215217 components = { {
216218 ...defaultMdxComponents ,
217219 CodeBlock,
218- h1 : ( props ) => < Heading as = 'h1' { ...props } /> ,
219- h2 : ( props ) => < Heading as = 'h2' { ...props } /> ,
220- h3 : ( props ) => < Heading as = 'h3' { ...props } /> ,
221- h4 : ( props ) => < Heading as = 'h4' { ...props } /> ,
222- h5 : ( props ) => < Heading as = 'h5' { ...props } /> ,
223- h6 : ( props ) => < Heading as = 'h6' { ...props } /> ,
220+ h1 : ( props : React . HTMLAttributes < HTMLHeadingElement > ) => (
221+ < Heading as = 'h1' { ...props } />
222+ ) ,
223+ h2 : ( props : React . HTMLAttributes < HTMLHeadingElement > ) => (
224+ < Heading as = 'h2' { ...props } />
225+ ) ,
226+ h3 : ( props : React . HTMLAttributes < HTMLHeadingElement > ) => (
227+ < Heading as = 'h3' { ...props } />
228+ ) ,
229+ h4 : ( props : React . HTMLAttributes < HTMLHeadingElement > ) => (
230+ < Heading as = 'h4' { ...props } />
231+ ) ,
232+ h5 : ( props : React . HTMLAttributes < HTMLHeadingElement > ) => (
233+ < Heading as = 'h5' { ...props } />
234+ ) ,
235+ h6 : ( props : React . HTMLAttributes < HTMLHeadingElement > ) => (
236+ < Heading as = 'h6' { ...props } />
237+ ) ,
224238 } }
225239 />
226240 </ DocsBody >
@@ -240,16 +254,17 @@ export async function generateMetadata(props: {
240254 const page = source . getPage ( params . slug , params . lang )
241255 if ( ! page ) notFound ( )
242256
257+ const data = page . data as PageData
243258 const baseUrl = 'https://docs.sim.ai'
244259 const fullUrl = `${ baseUrl } ${ page . url } `
245260
246- const description = page . data . description || ''
247- const ogImageUrl = `${ baseUrl } /api/og?title=${ encodeURIComponent ( page . data . title ) } &category=DOCUMENTATION${ description ? `&description=${ encodeURIComponent ( description ) } ` : '' } `
261+ const description = data . description || ''
262+ const ogImageUrl = `${ baseUrl } /api/og?title=${ encodeURIComponent ( data . title ) } &category=DOCUMENTATION${ description ? `&description=${ encodeURIComponent ( description ) } ` : '' } `
248263
249264 return {
250- title : page . data . title ,
265+ title : data . title ,
251266 description :
252- page . data . description || 'Sim visual workflow builder for AI applications documentation' ,
267+ data . description || 'Sim visual workflow builder for AI applications documentation' ,
253268 keywords : [
254269 'AI workflow builder' ,
255270 'visual workflow editor' ,
@@ -258,16 +273,16 @@ export async function generateMetadata(props: {
258273 'AI agents' ,
259274 'no-code AI' ,
260275 'drag and drop workflows' ,
261- page . data . title ?. toLowerCase ( ) . split ( ' ' ) ,
276+ data . title ?. toLowerCase ( ) . split ( ' ' ) ,
262277 ]
263278 . flat ( )
264279 . filter ( Boolean ) ,
265280 authors : [ { name : 'Sim Team' } ] ,
266281 category : 'Developer Tools' ,
267282 openGraph : {
268- title : page . data . title ,
283+ title : data . title ,
269284 description :
270- page . data . description || 'Sim visual workflow builder for AI applications documentation' ,
285+ data . description || 'Sim visual workflow builder for AI applications documentation' ,
271286 url : fullUrl ,
272287 siteName : 'Sim Documentation' ,
273288 type : 'article' ,
@@ -280,15 +295,15 @@ export async function generateMetadata(props: {
280295 url : ogImageUrl ,
281296 width : 1200 ,
282297 height : 630 ,
283- alt : page . data . title ,
298+ alt : data . title ,
284299 } ,
285300 ] ,
286301 } ,
287302 twitter : {
288303 card : 'summary_large_image' ,
289- title : page . data . title ,
304+ title : data . title ,
290305 description :
291- page . data . description || 'Sim visual workflow builder for AI applications documentation' ,
306+ data . description || 'Sim visual workflow builder for AI applications documentation' ,
292307 images : [ ogImageUrl ] ,
293308 creator : '@simdotai' ,
294309 site : '@simdotai' ,
0 commit comments