Files
website/apps/docs/app/og/docs/[...slug]/route.tsx
Mauricio Siu 0b52b9b1af docs: refactor code for consistency and readability
- Standardized import statements across various components to use double quotes for consistency.
- Updated component files to ensure proper formatting and adherence to coding standards.
- Enhanced overall code readability by aligning code structure and improving comment clarity.
- Made minor adjustments to ensure all components follow the same coding conventions, improving maintainability.
2025-12-07 18:13:12 -06:00

35 lines
764 B
TypeScript

import { getPageImage, source } from "@/lib/source";
import { generate as DefaultImage } from "fumadocs-ui/og";
import { notFound } from "next/navigation";
import { ImageResponse } from "next/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,
}));
}