import fs from 'fs'; import path from 'path'; import matter from 'gray-matter'; const CONTENT_DIR = path.join(process.cwd(), 'content'); export async function getMdxContent(locale: string, slug: string) { const filePath = path.join(CONTENT_DIR, locale, `${slug}.mdx`); if (!fs.existsSync(filePath)) { return null; } const source = fs.readFileSync(filePath, 'utf8'); const { content, data } = matter(source); return { content, frontmatter: data, }; }