Remove /md

This commit is contained in:
MartinBraquet
2025-12-27 13:06:22 +02:00
parent c7d58905b5
commit a5191b440e

View File

@@ -1,28 +0,0 @@
import fs from 'fs';
import path from 'path';
import MarkdownPage from "web/components/markdown";
type Props = {
content: string;
filename: string;
};
export default function Markdown({content, filename}: Props) {
return <MarkdownPage content={content} filename={filename}></MarkdownPage>
}
export async function getStaticPaths() {
const mdDir = path.join(process.cwd(), 'public', 'md');
const files = fs.readdirSync(mdDir);
const paths = files.map((file) => ({
params: {filename: file.replace(/\.md$/, '')},
}));
return {paths, fallback: false};
}
export async function getStaticProps({params}: { params: { filename: string } }) {
const filePath = path.join(process.cwd(), 'public', 'md', `${params.filename}.md`);
const content = fs.readFileSync(filePath, 'utf8');
return {props: {content, filename: params.filename}};
}