Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 9
Migrate docs from Mintlify to fumadocs#457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
6ed79ee9f94fda4d672462a8ff17a5659c12219ac89ba98c9a1c1731d21485a3b528d5d0371d93422937175b328f97c2503a16eee87fa55572441eeb51b76495c517179ea2ccb9da61d240ffc70ddfd42e74151f23385a93fe509e29715581a81b2924a171b8ab76815b9f13d8ba6a1a4ccfdcc1d3f4a46bfb91e8f795ac32f2efbFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,27 @@ | ||
| */.DS_Store | ||
| # deps | ||
| /node_modules | ||
| # generated content | ||
| .source | ||
| # test & build | ||
| /coverage | ||
| /.next/ | ||
| /out/ | ||
| /build | ||
| *.tsbuildinfo | ||
| # misc | ||
| .DS_Store | ||
| .env | ||
| *.pem | ||
| /.pnp | ||
| .pnp.js | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| node_modules/ | ||
| venv | ||
| __pycache__/** | ||
| test.py | ||
| ./kernel/** | ||
| # others | ||
| .env | ||
| .env*.local | ||
| .vercel | ||
| next-env.d.ts | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import { | ||
| DocsBody, | ||
| DocsDescription, | ||
| DocsPage, | ||
| DocsTitle, | ||
| MarkdownCopyButton, | ||
| } from "fumadocs-ui/layouts/notebook/page"; | ||
| import { createRelativeLink } from "fumadocs-ui/mdx"; | ||
| import type { Metadata } from "next"; | ||
| import { notFound, redirect } from "next/navigation"; | ||
| import { getMDXComponents } from "@/components/mdx"; | ||
| import { OpenInDropdown } from "@/components/page-actions"; | ||
| import { SocialFooter } from "@/components/social-footer"; | ||
| import { siteOpenGraph } from "@/lib/shared"; | ||
| import { getPageImage, getPageMarkdownUrl, source } from "@/lib/source"; | ||
| import { getEyebrow } from "@/lib/tree"; | ||
| export default async function Page(props: PageProps<"/[[...slug]]">) { | ||
| const params = await props.params; | ||
| const page = source.getPage(params.slug); | ||
| if (!page) notFound(); | ||
| // Mintlify url: frontmatter marks a page as an external sidebar link | ||
| if (page.data.url) redirect(page.data.url); | ||
| const MDX = page.data.body; | ||
| const markdownUrl = getPageMarkdownUrl(page).url; | ||
| const eyebrow = getEyebrow(params.slug ?? []); | ||
| // Mintlify's mode: wide widens the content column and drops the TOC | ||
| const full = page.data.full || page.data.mode === "wide"; | ||
| return ( | ||
| <DocsPage | ||
| toc={page.data.toc} | ||
| full={full} | ||
| breadcrumb={{ enabled: false }} | ||
| footer={{ children: <SocialFooter /> }} | ||
| > | ||
| {eyebrow ? ( | ||
| <span className="-mb-4 text-sm font-semibold text-fd-primary"> | ||
| {eyebrow} | ||
| </span> | ||
| ) : null} | ||
| <DocsTitle className="text-3xl tracking-tight sm:text-4xl"> | ||
| {page.data.title} | ||
| </DocsTitle> | ||
| <DocsDescription className="mb-0"> | ||
| {page.data.description} | ||
| </DocsDescription> | ||
| <div className="flex flex-row gap-2 items-center border-b pb-6"> | ||
| <MarkdownCopyButton markdownUrl={markdownUrl}> | ||
| Copy page | ||
| </MarkdownCopyButton> | ||
| <OpenInDropdown /> | ||
| </div> | ||
| <DocsBody> | ||
| <MDX | ||
| components={getMDXComponents({ | ||
| // this allows you to link to other pages with relative file paths | ||
| a: createRelativeLink(source, page), | ||
| })} | ||
| /> | ||
| </DocsBody> | ||
| </DocsPage> | ||
| ); | ||
cursor[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| export async function generateStaticParams() { | ||
| return source.generateParams(); | ||
| } | ||
| export async function generateMetadata( | ||
| props: PageProps<"/[[...slug]]">, | ||
| ): Promise<Metadata> { | ||
| const params = await props.params; | ||
| const page = source.getPage(params.slug); | ||
| if (!page) notFound(); | ||
| return { | ||
| title: page.data.title, | ||
| description: page.data.description, | ||
| alternates: { canonical: page.url }, | ||
| openGraph: { | ||
| ...siteOpenGraph, | ||
| url: page.url, | ||
| images: getPageImage(page).url, | ||
| }, | ||
cursor[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| }; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import { | ||
| DocsBody, | ||
| DocsDescription, | ||
| DocsPage, | ||
| DocsTitle, | ||
| } from "fumadocs-ui/layouts/notebook/page"; | ||
| import type { Metadata } from "next"; | ||
| import { notFound } from "next/navigation"; | ||
| import { OpenAPIPage } from "@/components/api-page"; | ||
| import { SocialFooter } from "@/components/social-footer"; | ||
| import { siteOpenGraph } from "@/lib/shared"; | ||
| import { apiSource, getApiPageImage } from "@/lib/source"; | ||
| export default async function Page( | ||
| props: PageProps<"/api-reference/[[...slug]]">, | ||
| ) { | ||
| const params = await props.params; | ||
| const page = apiSource.getPage(params.slug); | ||
| if (!page) notFound(); | ||
| return ( | ||
| <DocsPage toc={page.data.toc} footer={{ children: <SocialFooter /> }}> | ||
| <DocsTitle className="text-3xl tracking-tight sm:text-4xl"> | ||
| {page.data.title} | ||
| </DocsTitle> | ||
| {page.data.description ? ( | ||
| <DocsDescription className="mb-0"> | ||
| {page.data.description} | ||
| </DocsDescription> | ||
| ) : null} | ||
| <DocsBody> | ||
| <OpenAPIPage {...page.data.getOpenAPIPageProps()} /> | ||
| </DocsBody> | ||
| </DocsPage> | ||
| ); | ||
| } | ||
| export function generateStaticParams() { | ||
| return apiSource.generateParams(); | ||
| } | ||
| export async function generateMetadata( | ||
| props: PageProps<"/api-reference/[[...slug]]">, | ||
| ): Promise<Metadata> { | ||
| const params = await props.params; | ||
| const page = apiSource.getPage(params.slug); | ||
| if (!page) notFound(); | ||
| return { | ||
vercel[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| title: page.data.title, | ||
| description: page.data.description, | ||
| alternates: { canonical: page.url }, | ||
| openGraph: { | ||
| ...siteOpenGraph, | ||
| url: page.url, | ||
| images: getApiPageImage(page).url, | ||
| }, | ||
| }; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { buttonVariants } from "fumadocs-ui/components/ui/button"; | ||
| import { DocsLayout } from "fumadocs-ui/layouts/notebook"; | ||
| import { MessageCircleIcon } from "lucide-react"; | ||
| import { | ||
| AISearch, | ||
| AISearchPanel, | ||
| AISearchTrigger, | ||
| } from "@/components/ai/search"; | ||
| import { cn } from "@/lib/cn"; | ||
| import { baseOptions } from "@/lib/layout.shared"; | ||
| import { buildTree } from "@/lib/tree"; | ||
| export default function Layout({ children }: LayoutProps<"/">) { | ||
| return ( | ||
| <DocsLayout tree={buildTree()} tabMode="navbar" {...baseOptions()}> | ||
| <AISearch> | ||
| <AISearchPanel /> | ||
| <AISearchTrigger | ||
| position="float" | ||
| className={cn( | ||
| buttonVariants({ | ||
| variant: "secondary", | ||
| className: "text-fd-muted-foreground rounded-2xl", | ||
| }), | ||
| )} | ||
| > | ||
| <MessageCircleIcon className="size-4.5" /> | ||
| Ask AI | ||
| </AISearchTrigger> | ||
| </AISearch> | ||
| {children} | ||
| </DocsLayout> | ||
| ); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.