import { NextResponse } from 'next/server'; import { config } from '@/lib/config'; import { getBaseUrl } from '@/lib/seo'; import { headers } from 'next/headers'; export const dynamic = 'force-dynamic'; export const runtime = 'nodejs'; /** * Generate Open Graph image as SVG with correct aspect ratio (1.91:1 = 1200x630) * This prevents cropping on Facebook and Twitter */ export async function GET() { const baseUrl = await getBaseUrl(); const appName = config.appName; const bgColor = config.colors.backgroundColor || '#ffffff'; const primaryColor = config.colors.themeColor || '#000000'; // SVG with correct Open Graph dimensions: 1200x630 (1.91:1 ratio) // Safe area: 150px padding on all sides to prevent cropping // This ensures content is never cut off on Facebook/Twitter const svg = ` ${appName} ${config.domain} `; return new NextResponse(svg, { headers: { 'Content-Type': 'image/svg+xml', 'Cache-Control': 'public, max-age=3600, s-maxage=3600', }, }); }