|
1 | | -import { blogSource } from "../../../lib/source"; |
| 1 | +import { blogSource } from "@/lib/source"; |
2 | 2 | import { DocsBody, DocsTitle } from "@/components/layout/page"; |
3 | 3 | import { notFound } from "next/navigation"; |
4 | 4 | import { getMDXComponents } from "@/components/mdx-components"; |
5 | 5 | import type { Metadata } from "next"; |
6 | 6 | import { createRelativeLink } from "fumadocs-ui/mdx"; |
7 | 7 | import { CodeBlock } from "@/components/codeblock"; |
8 | 8 | import { BlogPage } from "@/components/layout/blog"; |
9 | | -import { getBlogMetadata } from "@/utils/blog"; |
| 9 | +import { getBlogMetadata, resolveAuthors } from "@/utils/blog"; |
| 10 | +import { PostAuthors } from "@/components/blog/post-authors"; |
10 | 11 | import { getBaseUrl } from "@/lib/base-url"; |
11 | 12 |
|
12 | 13 | export default async function Page(props: PageProps<"/blog/[...slug]">) { |
13 | 14 | const params = await props.params; |
14 | 15 | const page = blogSource.getPage(params.slug); |
15 | 16 | if (!page) notFound(); |
16 | 17 |
|
| 18 | + const slug = Array.isArray(params.slug) ? params.slug.join("/") : params.slug; |
17 | 19 | const MDX = page.data.body; |
| 20 | + const authors = resolveAuthors(page.data.authors); |
18 | 21 |
|
19 | 22 | return ( |
20 | | - <BlogPage toc={page.data.toc}> |
21 | | - <DocsTitle>{page.data.title}</DocsTitle> |
22 | | - <DocsBody className="w-full"> |
| 23 | + <BlogPage toc={page.data.toc} slug={slug}> |
| 24 | + <div className="flex flex-col gap-4"> |
| 25 | + {page.data.date && ( |
| 26 | + <time |
| 27 | + dateTime={page.data.date} |
| 28 | + className="text-xs uppercase tracking-wide text-brand-neutral-50" |
| 29 | + > |
| 30 | + {new Date(page.data.date).toLocaleDateString("en-US", { |
| 31 | + month: "short", |
| 32 | + day: "numeric", |
| 33 | + year: "numeric", |
| 34 | + })} |
| 35 | + </time> |
| 36 | + )} |
| 37 | + <DocsTitle>{page.data.title}</DocsTitle> |
| 38 | + {page.data.description && ( |
| 39 | + <p className="text-base text-brand-neutral-50 max-w-3xl pb-1"> |
| 40 | + {page.data.description} |
| 41 | + </p> |
| 42 | + )} |
| 43 | + <PostAuthors authors={authors} /> |
| 44 | + </div> |
| 45 | + <DocsBody className="w-full border-t border-white/20 pt-4"> |
23 | 46 | <MDX |
24 | 47 | components={getMDXComponents({ |
25 | 48 | // this allows you to link to other pages with relative file paths |
|
0 commit comments