Files
mintel.me/apps/web/app/api/og/[[...slug]]/route.tsx
Marc Mintel 43b96bb84b
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 6s
Build & Deploy / 🏗️ Build (push) Successful in 5m20s
Build & Deploy / 🧪 QA (push) Successful in 5m38s
Build & Deploy / 🚀 Deploy (push) Successful in 19s
Build & Deploy / 🩺 Health Check (push) Failing after 11s
Build & Deploy / 🔔 Notify (push) Successful in 2s
feat(og): adapt premium industrial style for OG images
2026-02-13 15:37:02 +01:00

43 lines
1.2 KiB
TypeScript

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 = "nodejs";
export async function GET(
request: Request,
{ params }: { params: Promise<{ slug?: string[] }> },
) {
const { slug: slugArray } = await params;
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";
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";
label = post ? "Blog Post" : "Engineering";
}
const fonts = await getOgFonts();
return new ImageResponse(
<OGImageTemplate title={title} description={description} label={label} />,
{
...OG_IMAGE_SIZE,
fonts: fonts as any,
},
);
}