File tree Expand file tree Collapse file tree 13 files changed +190
-31
lines changed Expand file tree Collapse file tree 13 files changed +190
-31
lines changed Original file line number Diff line number Diff line change 1- # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
3- # dependencies
1+ # deps
42/node_modules
53
6- # next.js
4+ # generated content
5+ .contentlayer
6+ .content-collections
7+ .source
8+
9+ # test & build
10+ /coverage
711/.next /
812/out /
9-
10- # production
1113/build
14+ * .tsbuildinfo
1215
13- # debug
16+ # misc
17+ .DS_Store
18+ * .pem
19+ /.pnp
20+ .pnp.js
1421npm-debug.log *
1522yarn-debug.log *
1623yarn-error.log *
17- .pnpm-debug.log *
1824
19- # env files
20- .env *
21-
22- # vercel
25+ # others
26+ .env * .local
2327.vercel
24-
25- # typescript
26- * .tsbuildinfo
2728next-env.d.ts
Original file line number Diff line number Diff line change 11# MCP
2+ https://fumadocs.vercel.app/
Original file line number Diff line number Diff line change 1+ import { source } from '@/lib/source' ;
2+ import {
3+ DocsPage ,
4+ DocsBody ,
5+ DocsDescription ,
6+ DocsTitle ,
7+ } from 'fumadocs-ui/page' ;
8+ import { notFound } from 'next/navigation' ;
9+ import defaultMdxComponents from 'fumadocs-ui/mdx' ;
10+
11+ export default async function Page ( props : {
12+ params : Promise < { slug ?: string [ ] } > ;
13+ } ) {
14+ const params = await props . params ;
15+ const page = source . getPage ( params . slug ) ;
16+ if ( ! page ) notFound ( ) ;
17+
18+ const MDX = page . data . body ;
19+
20+ return (
21+ < DocsPage toc = { page . data . toc } full = { page . data . full } >
22+ < DocsTitle > { page . data . title } </ DocsTitle >
23+ < DocsDescription > { page . data . description } </ DocsDescription >
24+ < DocsBody >
25+ < MDX components = { { ...defaultMdxComponents } } />
26+ </ DocsBody >
27+ </ DocsPage >
28+ ) ;
29+ }
30+
31+ export async function generateStaticParams ( ) {
32+ return source . generateParams ( ) ;
33+ }
34+
35+ export async function generateMetadata ( props : {
36+ params : Promise < { slug ?: string [ ] } > ;
37+ } ) {
38+ const params = await props . params ;
39+ const page = source . getPage ( params . slug ) ;
40+ if ( ! page ) notFound ( ) ;
41+
42+ return {
43+ title : page . data . title ,
44+ description : page . data . description ,
45+ } ;
46+ }
Original file line number Diff line number Diff line change 1+ import { DocsLayout } from 'fumadocs-ui/layouts/docs' ;
2+ import type { ReactNode } from 'react' ;
3+ import { baseOptions } from '@/app/layout.config' ;
4+ import { source } from '@/lib/source' ;
5+
6+ export default function Layout ( { children } : { children : ReactNode } ) {
7+ return (
8+ < DocsLayout tree = { source . pageTree } { ...baseOptions } >
9+ { children }
10+ </ DocsLayout >
11+ ) ;
12+ }
Original file line number Diff line number Diff line change 1+ import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared' ;
2+
3+ /**
4+ * Shared layout configurations
5+ *
6+ * you can customise layouts individually from:
7+ * Home Layout: app/(home)/layout.tsx
8+ * Docs Layout: app/docs/layout.tsx
9+ */
10+ export const baseOptions : BaseLayoutProps = {
11+ nav : {
12+ title : (
13+ < >
14+ < svg
15+ width = "24"
16+ height = "24"
17+ xmlns = "http://www.w3.org/2000/svg"
18+ aria-label = "Logo"
19+ >
20+ < circle cx = { 12 } cy = { 12 } r = { 12 } fill = "currentColor" />
21+ </ svg >
22+ My App
23+ </ >
24+ ) ,
25+ } ,
26+ links : [
27+ {
28+ text : 'Documentation' ,
29+ url : '/docs' ,
30+ active : 'nested-url' ,
31+ } ,
32+ ] ,
33+ } ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import type React from "react"
22import type { Metadata } from "next"
33import { Inter } from "next/font/google"
44import "./globals.css"
5-
5+ import { RootProvider } from 'fumadocs-ui/provider' ;
66const inter = Inter ( { subsets : [ "latin" ] } )
77
88export const metadata : Metadata = {
@@ -18,7 +18,15 @@ export default function RootLayout({
1818} > ) {
1919 return (
2020 < html lang = "en" >
21- < body className = { inter . className } > { children } </ body >
21+ < body className = { inter . className } >
22+ < RootProvider search = { {
23+ options : {
24+ type : 'static' ,
25+ } ,
26+ } } >
27+ { children }
28+ </ RootProvider >
29+ </ body >
2230 </ html >
2331 )
2432}
Original file line number Diff line number Diff line change @@ -29,10 +29,10 @@ export default function Home() {
2929 Compatible Tools
3030 </ Link >
3131 < Link
32- href = "# docs"
32+ href = "/ docs"
3333 className = "flex items-center text-sm font-medium text-muted-foreground transition-colors hover:text-primary"
3434 >
35- Documentation
35+ Docs
3636 </ Link >
3737 </ nav >
3838 </ div >
@@ -289,7 +289,7 @@ export default function Home() {
289289 </ section >
290290
291291 { /* Documentation Section */ }
292- < section id = "docs" className = "w-full py-12 md:py-24 lg:py-32 gradient-bg" >
292+ < section id = "docs" className = "w-full py-12 md:py-24 lg:py-32 gradient-bg" >
293293 < div className = "container px-4 md:px-6" >
294294 < div className = "flex flex-col items-center justify-center space-y-4 text-center" >
295295 < div className = "space-y-2" >
Original file line number Diff line number Diff line change 1+ ---
2+ title : Hello World
3+ description : Your first document
4+ ---
5+
6+ Welcome to the docs! You can start writing documents in ` /content/docs ` .
7+
8+ ## What is Next?
9+
10+ <Cards >
11+ <Card title = " Learn more about Next.js" href = " https://nextjs.org/docs" />
12+ <Card title = " Learn more about Fumadocs" href = " https://fumadocs.vercel.app" />
13+ </Cards >
Original file line number Diff line number Diff line change 1+ ---
2+ title : Components
3+ description : Components
4+ ---
5+
6+ ## Code Block
7+
8+ ``` js
9+ console .log (' Hello World' );
10+ ```
11+
12+ ## Cards
13+
14+ <Cards >
15+ <Card title = " Learn more about Next.js" href = " https://nextjs.org/docs" />
16+ <Card title = " Learn more about Fumadocs" href = " https://fumadocs.vercel.app" />
17+ </Cards >
Original file line number Diff line number Diff line change 1+ import { docs } from '@/.source' ;
2+ import { loader } from 'fumadocs-core/source' ;
3+
4+ export const source = loader ( {
5+ baseUrl : '/docs' ,
6+ source : docs . toFumadocsSource ( ) ,
7+ } ) ;
You can’t perform that action at this time.
0 commit comments