refined design
Some checks failed
Next.js App CI / docker (push) Failing after 3m19s

This commit is contained in:
2025-09-14 22:49:23 +02:00
parent 78de337446
commit 0444067c2d
89 changed files with 1117 additions and 594 deletions

View File

@@ -40,7 +40,7 @@ export async function markdownToHTML(markdown: string) {
export async function getPost(slug: string) {
const filePath = path.join("content", `${slug}.mdx`);
let source = fs.readFileSync(filePath, "utf-8");
const source = fs.readFileSync(filePath, "utf-8");
const { content: rawContent, data: metadata } = matter(source);
const content = await markdownToHTML(rawContent);
return {
@@ -51,14 +51,14 @@ export async function getPost(slug: string) {
}
async function getAllPosts(dir: string, category?: string) {
let mdxFiles = getMDXFiles(dir);
const mdxFiles = getMDXFiles(dir);
console.log(dir);
console.log(category);
console.log(mdxFiles);
const posts = await Promise.all(
mdxFiles.map(async (file) => {
let slug = path.basename(file, path.extname(file));
let { metadata, source } = await getPost(slug);
const slug = path.basename(file, path.extname(file));
const { metadata, source } = await getPost(slug);
console.log(file);
console.log(slug);
console.log(metadata);
@@ -79,8 +79,8 @@ async function getAllPosts(dir: string, category?: string) {
return posts;
}
export async function getBlogPosts(category?: string) {
let postPath = path.join(process.cwd(), "content");
export async function getPosts(category?: string) {
const postPath = path.join(process.cwd(), "content");
console.log(postPath);
return getAllPosts(postPath, category);
}