Add breadcrumbs in Magento2

I am going to explain here a way to add a breadcrumb in the default Magento Contact Us Page as an example

1) Create a layout file
I have a theme module Decryptweb_Project, so creating a layout file inside it


2) Reference the existing breadcrumbs block

<?xml version="1.0"?>
<page xmlns:xsi="" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> 
    <referenceBlock name="breadcrumbs">
            <action method="addCrumb">
                <argument name="crumbName" xsi:type="string" translate="true">Home</argument>
                <argument name="crumbInfo" xsi:type="array">
                    <item name="title" xsi:type="string" translate="true">Home</item>
                    <item name="label" xsi:type="string" translate="true">Home</item>
                    <item name="link" xsi:type="string">{{baseUrl}}</item>
            <action method="addCrumb">
                <argument name="crumbName" xsi:type="string" translate="true">Contact Us</argument>
                <argument name="crumbInfo" xsi:type="array">
                    <item name="title" xsi:type="string" translate="true">Contact Us</item>
                    <item name="label" xsi:type="string" translate="true">Contact Us</item>

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top