Skip to content

Commit 20cdcc5

Browse files
JonasJesus42claude
andcommitted
feat(seo): emit Product/Breadcrumb/ItemList JSON-LD on PDP and PLP (DECO-5281)
Wire the existing @decocms/apps JSON-LD components (ProductJsonLd, PLPJsonLd, BreadcrumbJsonLd from commerce/components/JsonLd) into the PDP (ProductDetails) and PLP (SearchResult) so Google can render rich results. Reuse only — no custom schema builder, no framework change. - PDP: ProductJsonLd(product) + BreadcrumbJsonLd(breadcrumbList) - PLP: PLPJsonLd(page) + BreadcrumbJsonLd(breadcrumb) JSON-LD is server-rendered inline; the framework forces sections eager for crawlers, so it's present in the initial SSR HTML bots see. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0305842 commit 20cdcc5

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/components/search/SearchResult.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import type { ProductListingPage } from "@decocms/apps/commerce/types";
2+
import {
3+
BreadcrumbJsonLd,
4+
PLPJsonLd,
5+
} from "@decocms/apps/commerce/components/JsonLd";
26
import { mapProductToAnalyticsItem } from "@decocms/apps/commerce/utils/productToAnalyticsItem";
37
import { useId } from "react";
48
import { useOffer } from "@decocms/apps/commerce/sdk/useOffer";
@@ -92,6 +96,9 @@ function Result({
9296
return (
9397
<div {...viewItemListEvent} className="w-full">
9498
<div className="container flex flex-col gap-4 sm:gap-5 w-full py-4 sm:py-5 px-5 sm:px-0">
99+
{/* SEO: schema.org JSON-LD, server-rendered inline (crawlers read it anywhere in the document) */}
100+
<PLPJsonLd page={page} />
101+
{breadcrumb && <BreadcrumbJsonLd breadcrumb={breadcrumb} />}
95102
<Breadcrumb itemListElement={breadcrumb?.itemListElement} />
96103

97104
<SearchFilterDrawer id={filterDrawerId} filters={filters} baseUrl={href} />

src/sections/Product/ProductDetails.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import type { ProductDetailsPage } from "@decocms/apps/commerce/types";
2+
import {
3+
BreadcrumbJsonLd,
4+
ProductJsonLd,
5+
} from "@decocms/apps/commerce/components/JsonLd";
26
import ProductHero, {
37
type HeroCopyConfig,
48
} from "../../components/product/pdp/ProductHero";
@@ -79,6 +83,9 @@ export default function ProductDetails({
7983

8084
return (
8185
<div className="container flex flex-col gap-4 sm:gap-5 w-full py-4 sm:py-5 px-5 sm:px-0">
86+
{/* SEO: schema.org JSON-LD, server-rendered inline (crawlers read it anywhere in the document) */}
87+
<ProductJsonLd product={page.product} />
88+
<BreadcrumbJsonLd breadcrumb={page.breadcrumbList} />
8289
<Breadcrumb itemListElement={page.breadcrumbList.itemListElement} />
8390
<ProductHero
8491
page={page}

0 commit comments

Comments
 (0)