diff --git a/apps/site/app/docs/[[...slug]]/page.tsx b/apps/site/app/docs/[[...slug]]/page.tsx index ddb5db1..c6d0e17 100644 --- a/apps/site/app/docs/[[...slug]]/page.tsx +++ b/apps/site/app/docs/[[...slug]]/page.tsx @@ -1,8 +1,33 @@ import { source } from '@/lib/source'; import { notFound } from 'next/navigation'; +import type { Metadata } from 'next'; -export const dynamicParams = true; -export const dynamic = 'force-dynamic'; +export const dynamicParams = false; + +export function generateStaticParams() { + return source.generateParams(); +} + +export async function generateMetadata(props: { + params: Promise<{ slug?: string[] }>; +}): Promise { + try { + const params = await props.params; + const page = source.getPage(params.slug); + + if (!page) { + return {}; + } + + return { + title: page.data.title || 'Documentation', + description: page.data.description || undefined, + }; + } catch (error) { + console.error('Error in generateMetadata:', error); + return {}; + } +} export default async function Page(props: { params: Promise<{ slug?: string[] }>; @@ -16,6 +41,9 @@ export default async function Page(props: { return (

{page.data.title || 'Untitled'}

+ {page.data.description && ( +

{page.data.description}

+ )}
{MDX && }
diff --git a/apps/site/content/docs/meta.json b/apps/site/content/docs/meta.json new file mode 100644 index 0000000..a9091d4 --- /dev/null +++ b/apps/site/content/docs/meta.json @@ -0,0 +1,8 @@ +{ + "title": "Documentation", + "pages": [ + "index", + "guide", + "spec" + ] +} diff --git a/apps/site/package.json b/apps/site/package.json index e02d147..7485c53 100644 --- a/apps/site/package.json +++ b/apps/site/package.json @@ -14,7 +14,7 @@ "fumadocs-mdx": "^14.2.5", "fumadocs-ui": "^15.0.0", "lucide-react": "^0.344.0", - "next": "^15.1.6", + "next": "^15.3.0", "react": "^18.3.1", "react-dom": "^18.3.1", "zod": "^4.3.5" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 81ad9ce..a648a7e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -82,7 +82,7 @@ importers: specifier: ^0.344.0 version: 0.344.0(react@18.3.1) next: - specifier: ^15.1.6 + specifier: ^15.3.0 version: 15.5.9(@babel/core@7.28.6)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react: specifier: ^18.3.1