1
votes

I have a custom child theme, the homepage layout is 2columns-left. I want to add a categories sidebar on the left, but I cannot get it to work.

I have a sidebar template located at:

app/design/frontend/../default/Magento_Catalog/templates/navigation/left.phtml

I made changed to default.xml

app/design/frontend/.../default/Magento_Catalog/view/frontend/layout/default.xml

It looks like this:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" layout="2columns-left">
    <body>
        <referenceContainer name="header-wrapper">
            <container name="compare-link-wrapper" label="Compare Link Wrapper" as="compare-link-wrapper" after="top.search" htmlTag="ul" htmlClass="compare wrapper">
                <block class="Magento\Framework\View\Element\Template" name="catalog.compare.link" before="-" template="Magento_Catalog::product/compare/link.phtml">
                    <arguments>
                        <argument name="jsLayout" xsi:type="array">
                            <item name="components" xsi:type="array">
                                <item name="compareProducts" xsi:type="array">
                                    <item name="component" xsi:type="string">Magento_Catalog/js/view/compare-products</item>
                                </item>
                            </item>
                        </argument>
                    </arguments>
                </block>
            </container>
        </referenceContainer>
        <referenceContainer name="sidebar.additional">
            <block class="Magento\Catalog\Block\Navigation" name="catalog.leftnav" before="-" template="navigation/left.phtml"/>
        </referenceContainer>
    </body>
</page>

I cannot get the sidebar to show up on the homepage. Am I adding it to the wrong file or doing something else wrong? I have cleared the cache, deployed static content etc with no luck. I am not getting any errors.

1

1 Answers

0
votes

Please check the home page layout and set 2 columns layout. You can also check by div class sidebar sidebar-main by using firebug.