| 1 | import { allWritings } from "content-collections"; |
| 2 | import { Metadata } |
| 3 | import { notFound } |
| 4 | import { MDXContent } |
| 5 | import defaultComponents from "fumadocs-ui/mdx |
| 6 | import { Pre, CodeBlock |
| 7 | |
| 8 | export async function generateStaticParams |
| 9 | return allWritings.map |
| 10 | } |
| 11 | export async function generateMetadata |
| 12 | params, |
| 13 | }: { |
| 14 | params: { |
| 15 | }): Promise<Metadata |
| 16 | const post = |
| 17 | if (!post) |
| 18 | return { |
| 19 | title: post.title |
| 20 | description: post.summary |
| 21 | openGraph: { |
| 22 | title: post.title |
| 23 | description: post.summary |
| 24 | }, |
| 25 | }; |
| 26 | } |
| 27 | |
| 28 | export default async function |
| 29 | const post = |
| 30 | (post) => |
| 31 | ); |
| 32 | if (!post) |
| 33 | return ( |
| 34 | <article className="min-h-screen container items-center justify-center flex-col |
| 35 | <div className="flex flex-col max-w-[600px] mx-auto p-0 |
| 36 | <div className="container prose prose-invert prose-lg my-5 |
| 37 | <h1 className="text-xl font-bold |
| 38 | <p className="text-base text-gray-400 mb-10 |
| 39 | <MDXContent |
| 40 | code={post.mdx |
| 41 | components={{ |
| 42 | ...defaultComponents, |
| 43 | pre: ({ ref |
| 44 | <CodeBlock {...props |
| 45 | <Pre>{props. |
| 46 | </CodeBlock> |
| 47 | ), |
| 48 | }} |
| 49 | /> |
| 50 | </div> |
| 51 | </div> |
| 52 | </article> |
| 53 | ); |
| 54 | } |