From a167c6643b401771360a53f477113af4dc70f492 Mon Sep 17 00:00:00 2001 From: consultoria-as Date: Sun, 22 Feb 2026 04:12:16 +0000 Subject: [PATCH] feat: add SEO metadata and Open Graph helpers Co-Authored-By: Claude Opus 4.6 --- apps/web/src/app/[locale]/layout.tsx | 6 ++++- apps/web/src/lib/metadata.ts | 35 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 apps/web/src/lib/metadata.ts diff --git a/apps/web/src/app/[locale]/layout.tsx b/apps/web/src/app/[locale]/layout.tsx index 202f004..41b0e5c 100644 --- a/apps/web/src/app/[locale]/layout.tsx +++ b/apps/web/src/app/[locale]/layout.tsx @@ -8,8 +8,12 @@ import { Footer } from "@/components/layout/Footer"; import "./globals.css"; export const metadata: Metadata = { - title: "Project Afterlife", + title: { + default: "Project Afterlife", + template: "%s | Project Afterlife", + }, description: "Preserving online games that deserve a second life", + metadataBase: new URL(process.env.NEXT_PUBLIC_SITE_URL || "https://projectafterlife.dev"), }; export default async function LocaleLayout({ diff --git a/apps/web/src/lib/metadata.ts b/apps/web/src/lib/metadata.ts new file mode 100644 index 0000000..a269f40 --- /dev/null +++ b/apps/web/src/lib/metadata.ts @@ -0,0 +1,35 @@ +import type { Metadata } from "next"; + +const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL || "https://projectafterlife.dev"; + +export function createMetadata({ + title, + description, + image, + path = "", +}: { + title: string; + description: string; + image?: string; + path?: string; +}): Metadata { + const url = `${BASE_URL}${path}`; + return { + title: `${title} | Project Afterlife`, + description, + openGraph: { + title, + description, + url, + siteName: "Project Afterlife", + images: image ? [{ url: image, width: 1200, height: 630 }] : [], + type: "website", + }, + twitter: { + card: "summary_large_image", + title, + description, + images: image ? [image] : [], + }, + }; +}