Skip to content

Commit

Permalink
chore: BreadcrumbList using full page URL for PDPs
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfp13 committed Feb 10, 2025
1 parent a1bf827 commit 908f240
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/core/src/pages/[slug]/p.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ function Page({ data: server, sections, globalSections, offers, meta }: Props) {
const { product } = server
const { currency } = useSession()
const titleTemplate = storeConfig?.seo?.titleTemplate ?? ''
let itemListElements = product.breadcrumbList.itemListElement ?? []

if (itemListElements.length !== 0) {
itemListElements = itemListElements.map(
({ item: pathname, name, position }) => {
const pageUrl = storeConfig.storeUrl + pathname

return { name, position, item: pageUrl }
}
)
}

const { client, isValidating } = isClientOfferEnabled
? (() => {
Expand Down Expand Up @@ -148,9 +159,7 @@ function Page({ data: server, sections, globalSections, offers, meta }: Props) {
]}
titleTemplate={titleTemplate}
/>
<BreadcrumbJsonLd
itemListElements={product.breadcrumbList.itemListElement}
/>
<BreadcrumbJsonLd itemListElements={itemListElements} />
<ProductJsonLd
productName={product.name}
description={product.description}
Expand Down

0 comments on commit 908f240

Please sign in to comment.