2

In order to create custom sidebar menus for my CMS pages in Magento 1, I used to be able to create a static block, and then use a widget to place it on all CMS pages that had a 2 column layout with left bar. That option is not available in Magento 2.

So, for Magento 2, I created a block called "guidenav", and I want it to appear on certain CMS pages, and for those CMS pages I can use this code in Layout Update XML:

<referenceContainer name="sidebar.additional">
    <block class="Magento\Cms\Block\Block" name="guidenav">
        <arguments>
            <argument name="block_id" xsi:type="string">guidenav</argument>
        </arguments>
    </block>
</referenceContainer>

The block isn't showing up. Any ideas?

1
  • In Magento 2 also you can create a cms block for guidenav and use a widget to place it on all CMS pages.
    – Sejal Shah
    Commented Jul 27, 2017 at 5:16

1 Answer 1

0

I found the solution in case this will help anyone. In Magento 2, if you want to create a left side bar navigation, (and remove wishlist and compare), you need the following code in the CMS Page Layout Update XML (I dont like editing files if I dont have to, thats why I like sysing Layout Update XML). My block is called "guidenav" that calls the menu.

<referenceContainer name="sidebar.additional">
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="wishlist_sidebar" remove="true" />
<referenceBlock name="sale.reorder.sidebar" remove="true" />
    <block class="Magento\Cms\Block\Block" name="guidenav">
        <arguments>
            <argument name="block_id" xsi:type="string">promo</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.