This commit is contained in:
tuna2134
2025-05-03 13:44:06 +00:00
parent 16ef79f6c9
commit f5d237ae17
10 changed files with 1169 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
import fs from "fs/promises";
interface PropsParams {
slug: string;
}
interface Props {
params: Promise<PropsParams>;
}
export default async function Page({ params }: Props) {
const { slug } = await params;
const { default: Post, metadata } = await import(`@/blogs/${slug}.mdx`);
return <Post />;
}
export async function generateStaticParams() {
const blogs = (await fs.readdir("blogs")).filter((name) =>
name.endsWith(".mdx"),
);
return blogs.map((name) => ({
slug: name.replace(/\.mdx$/, ""),
}));
}
export const dynamicParams = false;