Skip to content

Commit 2a0e98b

Browse files
authored
Merge pull request #363 from kiwicopple/claude/migrate-mkdocs-fumadocs-bGaNP
docs: migrate from MkDocs to Fumadocs
2 parents 970344b + e08c9c8 commit 2a0e98b

26 files changed

Lines changed: 1506 additions & 128 deletions

docs/assets/favicon.ico

-14.7 KB
Binary file not shown.

docs/index.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

docs/requirements_docs.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

mkdocs.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

website/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ yarn-error.log*
3434
# typescript
3535
*.tsbuildinfo
3636
next-env.d.ts
37+
38+
# fumadocs
39+
.source

website/app/api/search/route.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { source } from '@/lib/source'
2+
import { createFromSource } from 'fumadocs-core/search/server'
3+
4+
export const { GET } = createFromSource(source)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { source } from '@/lib/source'
2+
import {
3+
DocsPage,
4+
DocsBody,
5+
DocsTitle,
6+
DocsDescription,
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+
}

website/app/docs/layout.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { DocsLayout } from 'fumadocs-ui/layouts/docs'
2+
import type { ReactNode } from 'react'
3+
import { source } from '@/lib/source'
4+
5+
function Logo() {
6+
return (
7+
<>
8+
<style>{`
9+
.logo-light, .logo-dark { height: 28px; }
10+
.logo-dark { display: none !important; }
11+
.dark .logo-light { display: none !important; }
12+
.dark .logo-dark { display: block !important; }
13+
`}</style>
14+
<img
15+
src="/images/dbdev-lightmode.png"
16+
alt="dbdev logo"
17+
className="logo-light"
18+
/>
19+
<img
20+
src="/images/dbdev-darkmode.png"
21+
alt="dbdev logo"
22+
className="logo-dark"
23+
/>
24+
</>
25+
)
26+
}
27+
28+
export default function Layout({ children }: { children: ReactNode }) {
29+
return (
30+
<DocsLayout
31+
tree={source.pageTree}
32+
nav={{
33+
title: <Logo />,
34+
url: '/',
35+
}}
36+
>
37+
{children}
38+
</DocsLayout>
39+
)
40+
}

website/app/layout.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { RootProvider } from 'fumadocs-ui/provider'
2+
import type { ReactNode } from 'react'
3+
import 'fumadocs-ui/style.css'
4+
5+
export default function RootLayout({ children }: { children: ReactNode }) {
6+
return (
7+
<html lang="en" suppressHydrationWarning>
8+
<body>
9+
<RootProvider>{children}</RootProvider>
10+
</body>
11+
</html>
12+
)
13+
}

website/components/layouts/Navbar.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ const Navbar = () => {
106106
<div className="flex items-center justify-end gap-2 sm:gap-6 sm:min-w-[160px]">
107107
<div className="flex items-center ml-1 sm:ml-4">
108108
<Button variant="link" asChild>
109-
<Link href="https://supabase.github.io/dbdev/" target="blank">
110-
Docs
111-
</Link>
109+
<Link href="/docs">Docs</Link>
112110
</Button>
113111

114112
{user ? (

0 commit comments

Comments
 (0)