diff --git a/apps/web/app/api/og/[[...slug]]/route.tsx b/apps/web/app/api/og/[[...slug]]/route.tsx index b7d8701..8a36f60 100644 --- a/apps/web/app/api/og/[[...slug]]/route.tsx +++ b/apps/web/app/api/og/[[...slug]]/route.tsx @@ -1,89 +1,42 @@ -import { ImageResponse } from 'next/og'; -import { blogPosts } from '../../../../src/data/blogPosts'; +import { ImageResponse } from "next/og"; +import { blogPosts } from "../../../../src/data/blogPosts"; +import { OGImageTemplate } from "../../../../src/components/OGImageTemplate"; +import { getOgFonts, OG_IMAGE_SIZE } from "../../../../src/lib/og-helper"; -export const runtime = 'edge'; +export const runtime = "nodejs"; export async function GET( request: Request, - { params }: { params: Promise<{ slug?: string[] }> } + { params }: { params: Promise<{ slug?: string[] }> }, ) { const { slug: slugArray } = await params; - const slug = slugArray?.[0] || 'home'; + const slug = slugArray?.[0] || "home"; let title: string; let description: string; + let label: string | undefined; - if (slug === 'home') { - title = 'Marc Mintel'; - description = 'Technical problem solver\'s blog - practical insights and learning notes'; + if (slug === "home") { + title = "Marc Mintel"; + description = + "Technical problem solver's blog - practical insights and learning notes"; + label = "Engineering"; } else { - const post = blogPosts.find(p => p.slug === slug); - title = post?.title || 'Marc Mintel'; - description = (post?.description || 'Technical problem solver\'s blog - practical insights and learning notes').slice(0, 100); + const post = blogPosts.find((p) => p.slug === slug); + title = post?.title || "Marc Mintel"; + description = + post?.description || + "Technical problem solver's blog - practical insights and learning notes"; + label = post ? "Blog Post" : "Engineering"; } + const fonts = await getOgFonts(); + return new ImageResponse( - ( -