mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
- Synced with upstream fumadocs changes - Accepted upstream changes for all conflicts - Deleted files that no longer exist upstream - Maintains @hanzo package namespace
22 lines
598 B
TypeScript
22 lines
598 B
TypeScript
import { generateOGImage } from '@hanzo/docs/ui/og';
|
|
import { source } from '@/lib/source';
|
|
import { notFound } from 'next/navigation';
|
|
|
|
export async function GET(_req: Request, { params }: { params: Promise<{ slug: string[] }> }) {
|
|
const { slug } = await params;
|
|
const page = source.getPage(slug.slice(0, -1));
|
|
if (!page) notFound();
|
|
|
|
return generateOGImage({
|
|
title: page.data.title,
|
|
description: page.data.description,
|
|
});
|
|
}
|
|
|
|
export function generateStaticParams() {
|
|
return source.generateParams().map((page) => ({
|
|
...page,
|
|
slug: [...page.slug, 'image.png'],
|
|
}));
|
|
}
|