Product JSON-LD: add sku + gallery images, single-source the meta description

sku was tracked in Payload but never exposed to the frontend at all —
added to the Product type and wired into buildProductSchema (a real
Schema.org property Google's rich-result validator checks for).
image is now an array (main + gallery) when a product has gallery
photos, instead of always just the one main image.

/der-eine's page metadata description was a separately hardcoded
string that had drifted from Products.description (the one JSON-LD/
cart/checkout actually use) — now reads from the live product via
generateMetadata, same pattern /tasse-die-pause already uses. Updated
Payload's own description field to the more product-descriptive text
that used to live only in that hardcoded string.
This commit is contained in:
Marco
2026-08-26 21:20:44 +00:00
parent 39ebf2604d
commit 56fae6ff13
4 changed files with 24 additions and 17 deletions
+15 -16
View File
@@ -9,25 +9,24 @@ import { getProductBySlug, getCompanySettings } from "../lib/payload";
import { buildProductSchema } from "../lib/structuredData";
const title = "Der Eine. Für die eine Sache, die gerade zählt.";
const description =
"Der Eine. ist ein schlichter Kugelschreiber aus Metall. Angenehm in der Hand, klein genug für die Tasche und gemacht für alles, was kurz raus aus dem Kopf und irgendwo hin muss.";
export const metadata: Metadata = {
title,
description,
alternates: {
canonical: "/der-eine",
},
openGraph: {
// Description reads from the live product instead of a separately
// hardcoded string, unlike this page's own `title` — matches
// /tasse-die-pause's own pattern (see that page's comment). Two
// hand-maintained copies of the same text used to drift apart: this one
// used to say something different from Products.description (which feeds
// the cart/checkout/JSON-LD elsewhere) — same field, one source now.
export async function generateMetadata(): Promise<Metadata> {
const product = await getProductBySlug("stift-kugelschreiber");
const description = product?.description ?? undefined;
return {
title,
description,
url: "/der-eine",
},
twitter: {
title,
description,
},
};
alternates: { canonical: "/der-eine" },
openGraph: { title, description, url: "/der-eine" },
twitter: { title, description },
};
}
export default async function DerEinePage() {
const [product, seller] = await Promise.all([