mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-06 13:44:21 +08:00
- Updated the demo API to support locale-based content rendering. - Refactored the main layout to accommodate language-specific metadata and routing. - Introduced new components for blog and documentation pages, ensuring proper language handling. - Added styles for improved UI consistency across different sections. - Removed deprecated layout files and streamlined the structure for better maintainability.
32 lines
911 B
TypeScript
32 lines
911 B
TypeScript
import { getPageImageUrl, source } from '@/lib/source';
|
|
import { i18n } from '@/lib/i18n';
|
|
import { notFound } from 'next/navigation';
|
|
import { ImageResponse } from 'next/og';
|
|
import { generate as DefaultImage } from 'fumadocs-ui/og';
|
|
import { appName } from '@/lib/shared';
|
|
|
|
export const revalidate = false;
|
|
|
|
export async function GET(_req: Request, { params }: RouteContext<'/[lang]/og/docs/[...slug]'>) {
|
|
const { lang, slug } = await params;
|
|
const page = source.getPage(slug.slice(0, -1), lang);
|
|
if (!page) notFound();
|
|
|
|
return new ImageResponse(
|
|
<DefaultImage title={page.data.title} description={page.data.description} site={appName} />,
|
|
{
|
|
width: 1200,
|
|
height: 630,
|
|
},
|
|
);
|
|
}
|
|
|
|
export function generateStaticParams() {
|
|
return i18n.languages.flatMap((lang) =>
|
|
source.getPages(lang).map((page) => ({
|
|
lang,
|
|
slug: getPageImageUrl(page).segments,
|
|
})),
|
|
);
|
|
}
|