this repo has no description hallaine.com
at main 16 lines 393 B view raw
1"use server"; 2 3import { globby } from "globby"; 4 5export async function getSlugs() { 6 const files = await globby("*.mdx", { cwd: "src/content" }); 7 return files.map((file) => file.replace(/\.mdx$/, "")); 8} 9 10export async function getPostBySlug(slug: string) { 11 const { metadata, default: component } = await import( 12 `@/content/${slug}.mdx` 13 ); 14 15 return { slug, metadata, component }; 16}