import { ImageResponse } from "next/og"; import { readFile } from "node:fs/promises"; import { join } from "node:path"; export { getPageTitle } from "@/lib/page-titles"; // Cache font data in memory after first load let fontCache: { geistRegular: Buffer } | null = null; async function loadFonts() { if (fontCache) return fontCache; const geistRegular = await readFile( join(process.cwd(), "public/Geist-Regular.ttf"), ); fontCache = { geistRegular }; return fontCache; } export async function renderOgImage(title: string) { const { geistRegular } = await loadFonts(); return new ImageResponse(