Magento 2 – Call Breadcrumbs on Category and Product Pages

breadcrumbscategorymagento2product

I have my site running on Magento CE 2.0.2 version and I have breadcrumbs block code handy.

But I don't get how to call those breadcrumbs on Category and Product pages.

I tried putting the code into my theme's default.xml file like below:

<referenceContainer name="page.top">
            <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600"/>
            <container name="top.container" as="topContainer" label="After Page Header Top" htmlTag="div" htmlClass="top-container"/>
            <block class="Magento\Theme\Block\Html\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</referenceContainer>

Any help greatly appreciated.

Best Answer

There should be code you given in default.xml

<referenceContainer name="page.top">
       <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600"/>
                <container name="top.container" as="topContainer" label="After Page Header Top" htmlTag="div" htmlClass="top-container"/>
                <block class="Magento\Theme\Block\Html\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</referenceContainer>

You have to also check that remove tags in default.xml

<referenceBlock name="page.top" remove="true" />

Please remove this from default.xml or remove="false".

I hope this will help you.