wow
Some checks failed
/ print-content (push) Has been cancelled

This commit is contained in:
암냥 2026-05-31 13:55:12 +09:00
commit 58ce75b38a
No known key found for this signature in database
114 changed files with 966 additions and 17255 deletions

View file

@ -1,42 +0,0 @@
"use server";
import { readdirSync, readFileSync } from "fs";
import { join } from "path";
import matter from "gray-matter";
export interface Post {
slug: string;
title: string;
description: string;
date: string;
tags?: string[];
}
export async function getPosts(): Promise<Post[]> {
const postsDir = join(process.cwd(), "src/app/blog/posts");
const files = readdirSync(postsDir).filter((file) => file.endsWith(".mdx"));
const posts = files
.map((file) => {
const filePath = join(postsDir, file);
const fileContent = readFileSync(filePath, "utf-8");
const { data } = matter(fileContent);
const slug = file.replace(".mdx", "");
return {
slug,
title: data.title || "Untitled",
description: data.description || "",
date: data.date || "",
tags: data.tags || [],
};
})
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
return posts;
}
export async function getPostBySlug(slug: string): Promise<Post | null> {
const posts = await getPosts();
return posts.find((post) => post.slug === slug) || null;
}

View file

@ -1,6 +0,0 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}