Skip to content

Commit a1bf827

Browse files
committed
chore: BreadcrumbList using full page URL for PLPs
1 parent 3498a76 commit a1bf827

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

packages/core/src/components/templates/ProductListingPage/ProductListingPage.tsx

+12-3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ export default function ProductListingPage({
8181
const [pathname] = router.asPath.split('?')
8282
const canonical = `${storeConfig.storeUrl}${pathname}`
8383
const itemsPerPage = settings?.productGallery?.itemsPerPage ?? ITEMS_PER_PAGE
84+
let itemListElements = collection?.breadcrumbList.itemListElement ?? []
85+
86+
if (itemListElements.length !== 0) {
87+
itemListElements = itemListElements.map(
88+
({ item: pathname, name, position }) => {
89+
const pageUrl = storeConfig.storeUrl + pathname
90+
91+
return { name, position, item: pageUrl }
92+
}
93+
)
94+
}
8495

8596
return (
8697
<SearchProvider
@@ -100,9 +111,7 @@ export default function ProductListingPage({
100111
description,
101112
}}
102113
/>
103-
<BreadcrumbJsonLd
104-
itemListElements={collection?.breadcrumbList.itemListElement ?? []}
105-
/>
114+
<BreadcrumbJsonLd itemListElements={itemListElements} />
106115

107116
<ProductListing
108117
globalSections={globalSections}

0 commit comments

Comments
 (0)