Search code examples
spartacus-storefront

Spartacus Global Breadcrumbs Nested Hierarchy


We have a requirement to show nested breadcrumbs for product category pages. In the standard Spartacus template we have observed that the breadcrumb data is populated by the Search API.

How would we best approach adding a nested hierarchy of breadcrumbs by extending the standard API and/or Spartacus?


Solution

  • The breadcrumbs on the product listing page are data-driven, specifically by the active facets from the search data. There are various approaches to influence the data or resolve additional breadcrumbs:

    • Introduce breadcrumbs in the backend, either by indexing an alternative SOLR index, or populate additional data. This would make it transparent in Spartacus. We're in the wrong channel to discuss this in more detail, but this might be in your comfort zone.
    • Inject a custom converter in the Spartacus adapter layer, where you add additional breadcrumbs to the ProductSearchPage.breadcrumbs model.
    • Customise the CategoryPageMetaResolver.resolveBreadcrumbs and resolve additional breadcrumbs.