From 07af707484354315f30135e6b28088ddf860a39f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Ma=C3=B1osa?= <26429103+albertms10@users.noreply.github.com> Date: Sat, 22 Mar 2025 22:47:09 +0100 Subject: [PATCH] =?UTF-8?q?feat(opengraph-image):=20=F0=9F=92=84=20afegeix?= =?UTF-8?q?=20la=20previsualitzaci=C3=B3=20d=E2=80=99OpenGraph?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/[locale]/opengraph-image.tsx | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/app/[locale]/opengraph-image.tsx diff --git a/src/app/[locale]/opengraph-image.tsx b/src/app/[locale]/opengraph-image.tsx new file mode 100644 index 0000000..ae3b29b --- /dev/null +++ b/src/app/[locale]/opengraph-image.tsx @@ -0,0 +1,42 @@ +import { getTranslations } from "next-intl/server"; +import { ImageResponse } from "next/og"; +import { readFile } from "node:fs/promises"; +import { join } from "node:path"; + +export const alt = "Associació Catalana de l’Orgue"; +export const size = { width: 1200, height: 630 }; +export const contentType = "image/png"; + +export default async function Image({ + params, +}: { + params: Promise<{ locale: string }>; +}) { + const { locale } = await params; + const t = await getTranslations({ locale, namespace: "organization" }); + const fontSans = await readFile( + join(process.cwd(), "public/fonts/InterVariable.ttf"), + ); + + return new ImageResponse( + ( +