2025-07-27 10:05:37 -07:00
|
|
|
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/page";
|
|
|
|
|
import { notFound } from "next/navigation";
|
2026-04-02 19:45:28 -07:00
|
|
|
import { cache } from "react";
|
2025-07-27 10:05:37 -07:00
|
|
|
import { source } from "@/lib/source";
|
|
|
|
|
import { getMDXComponents } from "@/mdx-components";
|
2026-04-02 01:06:37 +05:30
|
|
|
|
|
|
|
|
const getDocPage = cache((slug?: string[]) => {
|
|
|
|
|
return source.getPage(slug);
|
|
|
|
|
});
|
2025-07-27 10:05:37 -07:00
|
|
|
|
|
|
|
|
export default async function Page(props: { params: Promise<{ slug?: string[] }> }) {
|
|
|
|
|
const params = await props.params;
|
2026-04-02 01:06:37 +05:30
|
|
|
const page = getDocPage(params.slug);
|
2025-07-27 10:05:37 -07:00
|
|
|
if (!page) notFound();
|
|
|
|
|
|
|
|
|
|
const MDX = page.data.body;
|
|
|
|
|
|
|
|
|
|
return (
|
2026-01-06 03:39:25 -08:00
|
|
|
<DocsPage
|
|
|
|
|
toc={page.data.toc}
|
|
|
|
|
full={page.data.full}
|
|
|
|
|
tableOfContent={{
|
|
|
|
|
style: "clerk",
|
|
|
|
|
single: false,
|
|
|
|
|
}}
|
|
|
|
|
tableOfContentPopover={{
|
|
|
|
|
style: "clerk",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2025-07-27 10:05:37 -07:00
|
|
|
<DocsTitle>{page.data.title}</DocsTitle>
|
|
|
|
|
<DocsDescription>{page.data.description}</DocsDescription>
|
|
|
|
|
<DocsBody>
|
|
|
|
|
<MDX components={getMDXComponents()} />
|
|
|
|
|
</DocsBody>
|
|
|
|
|
</DocsPage>
|
|
|
|
|
);
|
2025-04-22 02:24:13 -07:00
|
|
|
}
|
2025-07-27 10:05:37 -07:00
|
|
|
|
2025-04-22 02:24:13 -07:00
|
|
|
export async function generateStaticParams() {
|
2025-07-27 10:05:37 -07:00
|
|
|
return source.generateParams();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function generateMetadata(props: { params: Promise<{ slug?: string[] }> }) {
|
|
|
|
|
const params = await props.params;
|
2026-04-02 01:06:37 +05:30
|
|
|
const page = getDocPage(params.slug);
|
2025-07-27 10:05:37 -07:00
|
|
|
if (!page) notFound();
|
|
|
|
|
|
2026-04-11 23:38:12 -07:00
|
|
|
const slugPath = params.slug ? params.slug.join("/") : "";
|
2025-07-27 10:05:37 -07:00
|
|
|
return {
|
2026-04-11 23:38:12 -07:00
|
|
|
title: `${page.data.title} | SurfSense Docs`,
|
2025-07-27 10:05:37 -07:00
|
|
|
description: page.data.description,
|
2026-04-11 23:38:12 -07:00
|
|
|
alternates: {
|
|
|
|
|
canonical: `https://surfsense.com/docs${slugPath ? `/${slugPath}` : ""}`,
|
|
|
|
|
},
|
|
|
|
|
openGraph: {
|
|
|
|
|
title: `${page.data.title} | SurfSense Docs`,
|
|
|
|
|
description: page.data.description,
|
|
|
|
|
type: "article",
|
|
|
|
|
},
|
2025-07-27 10:05:37 -07:00
|
|
|
};
|
2025-04-22 02:24:13 -07:00
|
|
|
}
|