Skip to content

Commit

Permalink
Merge branch 'padms/2751' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
padms committed Jan 16, 2025
2 parents 7cab02f + 2166de4 commit e878966
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions web/core/Breadcrumbs/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ const buildJsonLdElements = (crumbs: Breadcrumb[], router: ReturnType<typeof use
}))
}

const capitalize = (text: string): string => text[0].toUpperCase() + text.slice(1)
const capitalize = (text: string): string => text?.[0].toUpperCase() + text?.slice(1)

const parseBreadcrumbs = (crumbs: Breadcrumb[]) => {
return crumbs.map((item) => ({
...item,
label: capitalize(item.label),
}))
return crumbs
.filter((item) => item?.slug && item?.label)
.map((item) => {
return {
...item,
label: capitalize(item.label),
}
})
}

export const Breadcrumbs = ({
Expand Down Expand Up @@ -76,4 +80,4 @@ export const Breadcrumbs = ({
<BreadcrumbJsonLd itemListElements={buildJsonLdElements(crumbs, router)} />
</BackgroundContainer>
)
}
}
2 changes: 1 addition & 1 deletion web/templates/newsroom/Newsroom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const NewsRoomTemplate = forwardRef<HTMLElement, NewsRoomTemplateProps>(function
const queriedSearchClient: SearchClient = {
...searchClient,
search(requests: any) {
if (requests.every(({ params }: any) => !params.query)) {
if (requests.every(({ params }: any) => !params.query && params?.facetFilters?.flat().length > 2)) {
return Promise.resolve({
results: requests.map(() => initialSearchResponse),
})
Expand Down

0 comments on commit e878966

Please sign in to comment.