import MDXComponents from "@/components/mdx/MDXComponents"; import { Locale, LOCALES } from "@/i18n/routing"; import { constructMetadata } from "@/lib/metadata"; import fs from "fs/promises"; import { Metadata } from "next"; import { getTranslations } from "next-intl/server"; import { MDXRemote } from "next-mdx-remote-client/rsc"; import path from "path"; import remarkGfm from "remark-gfm"; const options = { parseFrontmatter: true, mdxOptions: { remarkPlugins: [remarkGfm], rehypePlugins: [], }, }; async function getMDXContent(locale: string, section: string) { const filePath = path.join( process.cwd(), "content", "about", section, `${locale}.mdx` ); try { const content = await fs.readFile(filePath, "utf-8"); return content; } catch (error) { console.error(`Error reading MDX file: ${error}`); return ""; } } type Params = Promise<{ locale: string; }>; type MetadataProps = { params: Params; }; export async function generateMetadata({ params, }: MetadataProps): Promise { const { locale } = await params; const t = await getTranslations({ locale, namespace: "About" }); return constructMetadata({ page: "About", title: t("title"), description: t("description"), locale: locale as Locale, path: `/about`, canonicalUrl: `/about`, }); } export default async function AboutPage({ params, searchParams }: { params: Params; searchParams: Promise<{ [key: string]: string | string[] | undefined }>; }) { const { locale } = await params; const resolvedSearchParams = await searchParams; const section = (resolvedSearchParams.section as string) || "company"; const content = await getMDXContent(locale, section); return (
); } export async function generateStaticParams() { return LOCALES.map((locale) => ({ locale, })); }