0

I have moved my navigation menu to the sidebar by using

<move element="catalog.topnav" destination="sidebar.main" before="catalog.leftnav"/>

I wonder if I can add a title to it?

Right now, it looks like this and I want to add "Categories" on top of the menu:

I wonder if I can add this.

1

2 Answers 2

0

You can add a custom block to display custom text in sidebar.main container as below

<block class="Magento\Framework\View\Element\Text" name="about_us.label">
    <arguments>
        <argument translate="true" name="text" xsi:type="string">About Us</argument>
    </arguments>
</block>

For more check here

2
  • it is not showing anything, do you by any chance know why? Apr 12, 2021 at 13:43
  • @Magento_learner have you added this inside sidebar.main ? Apr 12, 2021 at 14:55
0

Figured it out, you can add title to block through XML by:

<referenceContainer name="sidebar.main">
            <block class="Magento\Framework\View\Element\Text" name="catalog.topnav.label" before="catalog.topnav">
                <arguments>
                    <argument name="text" xsi:type="string"><![CDATA[<div>Categories</div>]]></argument>
                </arguments>
            </block>
        </referenceContainer>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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