From 7094d39c1dbf29e3fcf332e01f87d982c577a842 Mon Sep 17 00:00:00 2001 From: vivektam Date: Tue, 21 May 2024 17:21:42 +0530 Subject: [PATCH] fixed empty and deplicate Breadcrumb in structured data --- CHANGELOG.md | 4 ++++ react/SearchBreadcrumb.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7563693..57f2d0e 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 + +- Fixed breadcrumb structured data issue in PLP where this field is missing `itemsListElement`. + ## [0.12.0] - 2023-05-10 ### Added diff --git a/react/SearchBreadcrumb.tsx b/react/SearchBreadcrumb.tsx index 8b77575..e1f68bc 100644 --- a/react/SearchBreadcrumb.tsx +++ b/react/SearchBreadcrumb.tsx @@ -11,7 +11,7 @@ interface SearchBreadcrumbItem { } const getSearchBreadcrumb = (breadcrumb?: SearchBreadcrumbItem[]) => { - if (!Array.isArray(breadcrumb)) { + if (!Array.isArray(breadcrumb) || breadcrumb?.length === 0) { return {} }