Is there additional configuration needed to make the breadcrumbs visible in a Spartacus-based site? There is a BreadcrumComponent instance inside the BottomHeaderSlot. If I load the page in the JSP-based site, a breadcrumb like "HOME / Warranty" is displayed for a /warranty page. But when I load the Spartacus-based site, it only shows "HOME". What am I missing? Do I need to edit the CMS controllers or map a breadcrumbBuilder to it?
3 Answers
I'm updating my answer as I misunderstood earlier, sorry for that.
Breadcrumbs are resolved in Spartacus by a specific PageMetaResolver
. The content pages are by default resolved by the ContentPageMetaResolver
, which you could extend.
The breakpoints resolved for Content pages (like the faq page in the sample data) are only contain a link to the home page. You could customise this by providing a custom implementation for the ContentPageMetaResolver
.
--- former answer, no longer relevant ---
The visibility depends on the availability of the BreadcrumbComponent
in the CMS structure. You can add this component in a page template or in a specific page.
You'll see this on the demo site, see https://spartacus.c39j2-walkersde1-d4-public.model-t.cc.commerce.ondemand.com/. On the home page there's no notion of the breadcrumb, while on other pages there is. In the sampledata, the BreadcrumbComponent is part of the components of the BottomHeaderSlot.

- 1,250
- 1
- 8
- 10
-
The Warranty page I mentioned has a BottomHeaderSlot which contains a breadcrumb. In the Hybris side, I can confirm/debug there is a breadcrumbComponent, but I've no idea what data it has. On thethe other hand, in the JSP-based controller, I can see there is "breadcrumbs" attribute in the model. I'm not sure what else I'm missing. Is it safe to say I'm good at Hybrise side, and just need to figure out what's going on in Spartacus side? – geffchang Jan 30 '20 at 12:06
(For reference) Adding comments from "Krzysztof Platis" in Slack:
Backend breadcrumb builders are not reflected in Spartacus, but you can build the breadcrumbs logic by extending and/or providing new PageMetaResolvers. See docs https://sap.github.io/cloud-commerce-spartacus-storefront-docs/seo-capabilities/#page-meta-resolvers.
There is missing a paragraph about breadcumbs. But as an example. you can see https://github.com/SAP/cloud-commerce-spartacus-storefront/blob/develop/projects/core/src/product/services/category-page-meta.resolver.ts#L125.
See: https://spartacus-storefront.slack.com/archives/CD16V16FR/p1580380905111000

- 3,279
- 2
- 32
- 58
You could, for example, extend the BasePageMegaResolver
class and override breadcrumb$
by replacing
this.routingPageMetaResolver?.resolveBreadcrumbs()
with
this.routingPageMetaResolver?.resolveBreadcrumbs({ includeCurrentRoute: true })
This option makes Spartacus include the current page in the Breadcrumbs array.

- 21
- 3