|
1 | | -import { source } from '@/lib/source'; |
| 1 | +import { createRelativeLink } from "fumadocs-ui/mdx"; |
2 | 2 | import { |
3 | | - DocsPage, |
4 | | - DocsBody, |
5 | | - DocsDescription, |
6 | | - DocsTitle, |
7 | | -} from 'fumadocs-ui/page'; |
8 | | -import { notFound } from 'next/navigation'; |
9 | | -import { createRelativeLink } from 'fumadocs-ui/mdx'; |
10 | | -import { getMDXComponents } from '@/mdx-components'; |
| 3 | + DocsBody, |
| 4 | + DocsDescription, |
| 5 | + DocsPage, |
| 6 | + DocsTitle, |
| 7 | +} from "fumadocs-ui/page"; |
| 8 | +import { notFound } from "next/navigation"; |
| 9 | +import { source } from "@/lib/source"; |
| 10 | +import { getMDXComponents } from "@/mdx-components"; |
11 | 11 |
|
12 | 12 | export default async function Page(props: { |
13 | | - params: Promise<{ slug?: string[] }>; |
| 13 | + params: Promise<{ slug?: string[] }>; |
14 | 14 | }) { |
15 | | - const params = await props.params; |
16 | | - const page = source.getPage(params.slug); |
17 | | - if (!page) notFound(); |
| 15 | + const params = await props.params; |
| 16 | + const page = source.getPage(params.slug); |
| 17 | + if (!page) notFound(); |
18 | 18 |
|
19 | | - const MDXContent = page.data.body; |
| 19 | + const MDXContent = page.data.body; |
20 | 20 |
|
21 | | - return ( |
22 | | - <DocsPage toc={page.data.toc} full={page.data.full}> |
23 | | - <DocsTitle>{page.data.title}</DocsTitle> |
24 | | - <DocsDescription>{page.data.description}</DocsDescription> |
25 | | - <DocsBody> |
26 | | - <MDXContent |
27 | | - components={getMDXComponents({ |
28 | | - // this allows you to link to other pages with relative file paths |
29 | | - a: createRelativeLink(source, page), |
30 | | - })} |
31 | | - /> |
32 | | - </DocsBody> |
33 | | - </DocsPage> |
34 | | - ); |
| 21 | + return ( |
| 22 | + <DocsPage toc={page.data.toc} full={page.data.full}> |
| 23 | + <DocsTitle>{page.data.title}</DocsTitle> |
| 24 | + <DocsDescription>{page.data.description}</DocsDescription> |
| 25 | + <DocsBody> |
| 26 | + <MDXContent |
| 27 | + components={getMDXComponents({ |
| 28 | + // this allows you to link to other pages with relative file paths |
| 29 | + a: createRelativeLink(source, page), |
| 30 | + })} |
| 31 | + /> |
| 32 | + </DocsBody> |
| 33 | + </DocsPage> |
| 34 | + ); |
35 | 35 | } |
36 | 36 |
|
37 | 37 | export async function generateStaticParams() { |
38 | | - return source.generateParams(); |
| 38 | + return source.generateParams(); |
39 | 39 | } |
40 | 40 |
|
41 | 41 | export async function generateMetadata(props: { |
42 | | - params: Promise<{ slug?: string[] }>; |
| 42 | + params: Promise<{ slug?: string[] }>; |
43 | 43 | }) { |
44 | | - const params = await props.params; |
45 | | - const page = source.getPage(params.slug); |
46 | | - if (!page) notFound(); |
| 44 | + const params = await props.params; |
| 45 | + const page = source.getPage(params.slug); |
| 46 | + if (!page) notFound(); |
47 | 47 |
|
48 | | - return { |
49 | | - title: page.data.title, |
50 | | - description: page.data.description, |
51 | | - }; |
| 48 | + return { |
| 49 | + title: page.data.title, |
| 50 | + description: page.data.description, |
| 51 | + }; |
52 | 52 | } |
0 commit comments