import { ImageResponse } from 'next/og'; import { NextRequest } from 'next/server'; export const runtime = 'edge'; export async function GET(req: NextRequest) { const { searchParams } = req.nextUrl; const title = searchParams.get('title'); const description = searchParams.get('description'); const font = fetch(new URL('./mono.ttf', import.meta.url)).then((res) => res.arrayBuffer(), ); const fontData = await font; return new ImageResponse( (
20 ? 64 : 80, letterSpacing: '-0.04em', }} > {title}
{`${description?.slice(0, 100)}`}
), { width: 1200, height: 628, fonts: [ { name: 'Jetbrains Mono', data: fontData, style: 'normal', }, ], }, ); }