almost done

This commit is contained in:
2025-09-12 23:20:36 +02:00
parent 7b41bd3f75
commit 37b8f0968a
168 changed files with 5022 additions and 3709 deletions

18
lib/post.ts Normal file
View File

@@ -0,0 +1,18 @@
import fs from "fs";
import path from "path";
import matter from "gray-matter";
const postsDirectory = path.join(process.cwd(), "..", "_posts");
export async function getPostData(category: string, id: string) {
const fullPath = path.join(postsDirectory, category, `${id}.md`);
const fileContents = fs.readFileSync(fullPath, "utf8");
const matterResult = matter(fileContents);
return {
id,
content: matterResult.content,
...matterResult.data,
};
}