mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-13 04:11:23 -04:00
Remove /md
This commit is contained in:
@@ -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}};
|
||||
}
|
||||
Reference in New Issue
Block a user