Magento 2 – How to Change Layout of Category List Page by XML

catalogcategorymagento2

I want to change layout of category listing page from 2columns-left to 1column by xml.

for this what i have tried so far.

In root\magento-ce-2.0.0\vendor\magento\module-catalog\view\frontend\layout\catalog_category_view.xml

I changed

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

to

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

but this is not working, whereas if i change Page Layout of category from admin of then changes reflecting but i don't want to make changes from admin i want it from xml.

Can any one please help me for this.

Best Answer

May be other module rewrite that layout please check other module not conflict with it.

It is bad habit to edit core files create module and add file to

app/code/Vendor/Modulename/view/frontend/layout/catalog_category_view.xml

add below code to file:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head></head>
    <body></body>
</page>
Related Topic