File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ export default async function Page({
1717 const page = source . getPage ( slug ) ;
1818 if ( ! page ) notFound ( ) ;
1919
20- const MDX = page . data . body ;
20+ const MDX = ( page . data as any ) . body ;
2121
2222 return (
23- < DocsPage toc = { page . data . toc } full = { page . data . full } >
23+ < DocsPage toc = { ( page . data as any ) . toc } full = { ( page . data as any ) . full } >
2424 < DocsTitle > { page . data . title } </ DocsTitle >
2525 < DocsDescription > { page . data . description } </ DocsDescription >
2626 < DocsBody >
@@ -46,3 +46,4 @@ export async function generateMetadata(props: {
4646 description : page . data . description ,
4747 } ;
4848}
49+
Original file line number Diff line number Diff line change 1- import { docs } from '@/.source' ;
21import { loader } from 'fumadocs-core/source' ;
3- import { createMDXSource } from 'fumadocs-mdx' ;
2+ import { docs } from '@/.source' ;
3+
4+ // Map the docs from .source to the format expected by loader
5+ const mappedDocs = docs
6+ . filter ( ( doc : any ) => doc && doc . info && doc . info . path )
7+ . map ( ( doc : any ) => {
8+ let path = doc . info . path . replace ( / \. m d x ? $ / , '' ) ;
9+ // Convert index.mdx to empty path
10+ if ( path === 'index' ) path = '' ;
11+
12+ return {
13+ type : 'page' as const ,
14+ path,
15+ data : {
16+ ...doc . data ,
17+ body : doc . data . default ,
18+ } ,
19+ } ;
20+ } ) ;
421
522export const source = loader ( {
623 baseUrl : '/docs' ,
7- source : createMDXSource ( docs , [ ] ) ,
24+ source : {
25+ files : mappedDocs ,
26+ } ,
827} ) ;
You can’t perform that action at this time.
0 commit comments