Is there additional configuration needed to make the breadcrumbs visible in a Spartacus site?

徘徊边缘 提交于 2021-01-29 17:22:01

问题


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?


回答1:


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.




回答2:


(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



来源:https://stackoverflow.com/questions/59984167/is-there-additional-configuration-needed-to-make-the-breadcrumbs-visible-in-a-sp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!