Files
website/apps/docs-new/app/og/docs/[...slug]/route.tsx
Mauricio Siu 95682a01c2 feat: add new documentation and assets for the website
- Introduced new MDX components and configuration files for the documentation site.
- Added various images and icons to enhance the visual representation of the documentation.
- Updated package.json and pnpm-lock.yaml to include new dependencies for the documentation.
- Created a .gitignore file for the new docs app to manage ignored files effectively.
- Enhanced README with instructions for restarting the dev server after adding new MDX files.
2025-12-07 05:12:07 -06:00

35 lines
800 B
TypeScript

import { getPageImage, source } from '@/lib/source';
import { notFound } from 'next/navigation';
import { ImageResponse } from 'next/og';
import { generate as DefaultImage } from 'fumadocs-ui/og';
export const revalidate = false;
export async function GET(
_req: Request,
{ params }: RouteContext<'/og/docs/[...slug]'>,
) {
const { slug } = await params;
const page = source.getPage(slug.slice(0, -1));
if (!page) notFound();
return new ImageResponse(
<DefaultImage
title={page.data.title}
description={page.data.description}
site="My App"
/>,
{
width: 1200,
height: 630,
},
);
}
export function generateStaticParams() {
return source.getPages().map((page) => ({
lang: page.locale,
slug: getPageImage(page).segments,
}));
}