From ba78b6e939163fe530ee513b8a5ae8c40878eb06 Mon Sep 17 00:00:00 2001 From: Iago Espinoza Date: Mon, 30 Sep 2024 15:46:15 -0300 Subject: [PATCH] fix: duplicated structured data in product search context --- CHANGELOG.md | 4 ++++ react/Gallery.tsx | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb81de56d..04f338e38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- Duplicated structured data in product search context + ## [3.133.0] - 2024-08-01 ### Added diff --git a/react/Gallery.tsx b/react/Gallery.tsx index e8ff8c3de..0e2866ac1 100644 --- a/react/Gallery.tsx +++ b/react/Gallery.tsx @@ -1,5 +1,6 @@ import React, { Fragment } from 'react' import { ProductList as ProductListStructuredData } from 'vtex.structured-data' +import { useRuntime } from 'vtex.render-runtime' import GalleryLayout from './GalleryLayout' import type { GalleryLayoutProps, Slots } from './GalleryLayout' @@ -16,6 +17,10 @@ type GalleryLayoutPropsWithSlots = Omit & Slots const Gallery: React.FC< GalleryLegacyProps | GalleryLayoutPropsWithSlots > = props => { + const { + route: { routeId }, + } = useRuntime() + if ('layouts' in props && props.layouts.length > 0) { const { layouts, @@ -29,7 +34,9 @@ const Gallery: React.FC< return ( - + {!routeId.includes('store.search') && ( + + )}