Skip to content

Instantly share code, notes, and snippets.

@evgv
Last active January 2, 2017 14:05
Show Gist options
  • Save evgv/bafbbd0f77f8b62a3633e51a7f5d2c75 to your computer and use it in GitHub Desktop.
Save evgv/bafbbd0f77f8b62a3633e51a7f5d2c75 to your computer and use it in GitHub Desktop.
Magento 2. Remove block from layout

Remove block from layout

As example remove footer block from homepage.

We need change/rewrite layout cms_index_index.xml in base/luma or in any custom theme, namely add

Full code example:

    
    <?xml version="1.0"?>
    <!--
    /**
     * Copyright © 2017 Magento. All rights reserved.
     * See COPYING.txt for license details.
     */
    -->
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
            <referenceBlock name="footer" remove="true"/>
        </body>
    </page>

thereafter we need flush cache, simple way execute this command in console:
bin/magento cache:flush && bin/magento cache:clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment