diff --git a/package.json b/package.json index 9cd0847..64ad4a7 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "test:e2e": "playwright test --config tests/e2e/playwright.config.ts" }, "dependencies": { + "@aws-sdk/client-s3": "^3.956.0", "@radix-ui/react-alert-dialog": "^1.1.15", "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.2", @@ -48,6 +49,7 @@ "marked": "^16.1.2", "mermaid": "^11.12.2", "next": "^16.0.9", + "next-mdx-remote": "^5.0.0", "next-themes": "^0.4.6", "pdfjs-dist": "^4.2.67", "prismjs": "^1.30.0", diff --git a/src/app/blog/[...slug]/page.tsx b/src/app/blog/[...slug]/page.tsx index 67d6c29..d6b6c58 100644 --- a/src/app/blog/[...slug]/page.tsx +++ b/src/app/blog/[...slug]/page.tsx @@ -1,6 +1,7 @@ import Link from 'next/link' import { notFound } from 'next/navigation' -import { readMarkdownFile } from '@lib/markdown' +import { compileMDX } from 'next-mdx-remote/rsc' +import { readMdxFile } from '@lib/mdx' import { resolveBlogContentRoot } from '@lib/marketingContent' import type { Metadata } from 'next' @@ -31,7 +32,7 @@ export async function generateMetadata({ params }: PageProps): Promise const slugPath = Array.isArray(slug) ? slug.join('/') : slug try { const blogContentRoot = resolveBlogContentRoot() - const file = await readMarkdownFile(`${slugPath}.md`, { baseDir: blogContentRoot }) + const file = await readMdxFile(slugPath, { baseDir: blogContentRoot }) const title = file.metadata.title as string const excerpt = (file.metadata.excerpt as string) || '' @@ -52,7 +53,10 @@ export default async function BlogPostPage({ params }: PageProps) { const slugPath = Array.isArray(slug) ? slug.join('/') : slug try { const blogContentRoot = resolveBlogContentRoot() - const file = await readMarkdownFile(`${slugPath}.md`, { baseDir: blogContentRoot }) + const file = await readMdxFile(slugPath, { baseDir: blogContentRoot }) + const mdx = await compileMDX({ + source: file.content, + }) const title = (file.metadata.title as string) || slugPath const author = file.metadata.author as string | undefined @@ -105,8 +109,9 @@ export default async function BlogPostPage({ params }: PageProps) { {/* Article content */}
+ > + {mdx.content} +
{/* Footer */}