-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cac3ff2
commit 45342e3
Showing
2 changed files
with
32 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,37 @@ | ||
import { source } from '@/lib/source'; | ||
import { | ||
DocsPage, | ||
DocsBody, | ||
DocsDescription, | ||
DocsTitle, | ||
} from 'fumadocs-ui/page'; | ||
import { notFound } from 'next/navigation'; | ||
import defaultMdxComponents from 'fumadocs-ui/mdx'; | ||
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/page'; | ||
import { notFound } from 'next/navigation'; | ||
|
||
export default async function Page(props: { | ||
params: Promise<{ slug?: string[] }>; | ||
}) { | ||
const params = await props.params; | ||
const page = source.getPage(params.slug); | ||
if (!page) notFound(); | ||
export default async function Page(props: { params: Promise<{ slug?: string[] }> }) { | ||
const params = await props.params; | ||
const page = source.getPage(params.slug); | ||
if (!page) notFound(); | ||
|
||
const MDX = page.data.body; | ||
const MDX = page.data.body; | ||
|
||
return ( | ||
<DocsPage toc={page.data.toc} full={page.data.full}> | ||
<DocsTitle>{page.data.title}</DocsTitle> | ||
<DocsDescription>{page.data.description}</DocsDescription> | ||
<DocsBody> | ||
<MDX components={{ ...defaultMdxComponents }} /> | ||
</DocsBody> | ||
</DocsPage> | ||
); | ||
return ( | ||
<DocsPage full={page.data.full} toc={page.data.toc}> | ||
<DocsTitle>{page.data.title}</DocsTitle> | ||
<DocsDescription>{page.data.description}</DocsDescription> | ||
<DocsBody> | ||
<MDX components={{ ...defaultMdxComponents }} /> | ||
</DocsBody> | ||
</DocsPage> | ||
); | ||
} | ||
|
||
export async function generateStaticParams() { | ||
return source.generateParams(); | ||
return source.generateParams(); | ||
} | ||
|
||
export async function generateMetadata(props: { | ||
params: Promise<{ slug?: string[] }>; | ||
}) { | ||
const params = await props.params; | ||
const page = source.getPage(params.slug); | ||
if (!page) notFound(); | ||
export async function generateMetadata(props: { params: Promise<{ slug?: string[] }> }) { | ||
const params = await props.params; | ||
const page = source.getPage(params.slug); | ||
if (!page) notFound(); | ||
|
||
return { | ||
title: page.data.title, | ||
description: page.data.description, | ||
}; | ||
return { | ||
description: page.data.description, | ||
title: page.data.title, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import { DocsLayout } from 'fumadocs-ui/layouts/docs'; | ||
import type { ReactNode } from 'react'; | ||
|
||
import { baseOptions } from '@/app/layout.config'; | ||
import { source } from '@/lib/source'; | ||
import { DocsLayout } from 'fumadocs-ui/layouts/docs'; | ||
|
||
export default function Layout({ children }: { children: ReactNode }) { | ||
return ( | ||
<DocsLayout tree={source.pageTree} {...baseOptions}> | ||
{children} | ||
</DocsLayout> | ||
); | ||
return ( | ||
<DocsLayout tree={source.pageTree} {...baseOptions}> | ||
{children} | ||
</DocsLayout> | ||
); | ||
} |