0

I have added the following code to the following file.

app/design/frontend/Emthemes/everything/diamond/Magento_Catalog/layout/default.xml

<move element="breadcrumbs" destination="content" before="-" />

But it's not working for me.
Anyone can help me regarding this.

2
  • breadcrumbs already displayed by default on those pages. Jul 23, 2018 at 12:39
  • No its not showing on my project so i have added in default.xml Jul 23, 2018 at 12:45

3 Answers 3

1

as @Suresh Chikani mentioned in the comment, breadcrumbs are displayed OOTB in those places(product page & category), if it's not then somebody removed it.

It could be removed in few ways

1) somebody removed the parent block in which the block containing your functionality was, in this case just "move" the block containing your desired functionality to a different existing block/container

2) somebody removed the block, you need to find the code and change it or add a new block as you done in your answer.

3) Somebody could rewrite the block class (Magento\Theme\Block\Html\Breadcrumbs) itself and override the toHtml function or any other that is responsible for displaying content. Look in

di.xml

for

Magento\Theme\Block\Html\Breadcrumbs

if nothing is found then no one rewritten it.

4) Somebody could rewritten

vendor/magento/module-theme/view/frontend/layout/default.xml

Where the setup of breadcrumbs originally takes place.

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-override.html

And going back to your question, if you want only add it only category & product page then you should add it to

catalog_product_view.xml
catalog_category_view.xml

not to default.xml

0

Try below code to display breadcrumbs on list or detail page

<move element="breadcrumbs" destination="page.top"  />
9
  • Hi Suresh thanks for your response let's me check and revert Jul 24, 2018 at 5:52
  • Okay check it from your and let me know if not working. Jul 24, 2018 at 5:53
  • No bro its not working for me Jul 24, 2018 at 5:54
  • I have added this code and also run cache clean and flush command Jul 24, 2018 at 5:55
  • Please find breadcrumbs keyword and check in your theme and module, I think in somewhere remove breadcrumbs from layout. Jul 24, 2018 at 5:56
0

Added the following code to this path:

app/design/frontend/Emthemes/everything/diamond/Magento_Theme/layout/default.xml

<referenceContainer name="page.top">
                <block class="Magento\Theme\Block\Html\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
        </referenceContainer>
1
  • Is this even working ? I mean, the pattern for design is usually app/design/frontend/VENDOR/THEME(2lvls) and you instead of that have an extra level (3rd) Your code adds it to all pages, not only to the category & product page, anyway breadcrumbs are OOTB May 3, 2020 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.