MCPcopy
hub / github.com/colinhacks/zod / Page

Function Page

packages/docs/app/(doc)/[[...slug]]/page.tsx:15–73  ·  view source on GitHub ↗
(props: {
  params: Promise<{ slug?: string[] }>;
})

Source from the content-addressed store, hash-verified

13export const dynamic = "force-static";
14
15export default async function Page(props: {
16 params: Promise<{ slug?: string[] }>;
17}) {
18 const params = await props.params;
19 const page = source.getPage(params.slug);
20 if (!page) notFound();
21
22 const title = page.data.title;
23 const markdownContent = await getLLMText(page);
24
25 const MDXContent = page.data.body;
26 const toc = page.data.toc
27 .filter((item) => item.depth <= 3)
28 .map((item) => {
29 return item;
30 });
31
32 return (
33 <DocsPage toc={toc} tableOfContent={{ style: "clerk", single: false }} full={false}>
34 {title && title !== "Intro" && (
35 <div className="mb-6">
36 <DocsTitle>{title}</DocsTitle>
37 <div className="h-2" />
38 <div className="flex items-center gap-2">
39 <CopyMarkdownButton content={markdownContent} />
40 <a
41 href={`https://github.com/colinhacks/zod/edit/main/packages/docs/content/${page.file.path}`}
42 target="_blank"
43 rel="noreferrer noopener"
44 className="inline-flex items-center gap-1.5 px-2 py-1 text-xs text-fd-muted-foreground hover:text-fd-foreground border border-[var(--color-fd-border)] rounded hover:bg-fd-muted/50 transition-colors"
45 >
46 <Github className="w-3 h-3" />
47 Edit this page
48 </a>
49 </div>
50 </div>
51 )}
52 {/* <DocsDescription>{description}</DocsDescription> */}
53 <DocsBody {...{}}>
54 <MDXContent
55 components={{
56 ...defaultMdxComponents,
57 // this allows you to link to other pages with relative file paths
58 a: createRelativeLink(source, page),
59 // you can add other MDX components here
60 blockquote: Callout,
61 Tabs,
62 h1: (props) => <Heading as="h1" {...props} />,
63 h2: (props) => <Heading as="h2" {...props} />,
64 h3: (props) => <Heading as="h3" {...props} />,
65 h4: (props) => <Heading as="h4" {...props} />,
66 h5: (props) => <Heading as="h5" {...props} />,
67 h6: (props) => <Heading as="h6" {...props} />,
68 }}
69 />
70 </DocsBody>
71 </DocsPage>
72 );

Callers

nothing calls this directly

Calls 1

getLLMTextFunction · 0.90

Tested by

no test coverage detected