import { ImageResponse } from '@vercel/og' import { NextRequest } from 'next/server' export const config = { runtime: 'edge', } export default function handler(req: NextRequest) { try { const { searchParams } = new URL(req.url) const hasTitle = searchParams.has('title') const title = hasTitle ? searchParams.get('title')?.slice(0, 100) : 'A11yWatch Web Accessibility Tool' return new ImageResponse( (
A11yWatch
{title}
), { width: 1200, height: 630, } ) } catch (e) { return new Response(`Failed to generate the image`, { status: 500, }) } }