Magento – Layout xml: Error in the page layout tag, how to analyse

layoutmagento2

Whats wrong in the xml declaration below:

m_index_index.xml

<?xml version="1.0"?>
<page layout ="2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
   <referenceContainer name="content">
        <block class="Magento\Catalog\Block\Product\ListProduct" name="product_list" template="Magento_Catalog::product/list.phtml">
            <block class="Magento\Framework\View\Element\RendererList" name="category.product.type.details.renderers" as="details.renderers">
                <block class="Magento\Framework\View\Element\Template" as="default"/>
            </block>
            <block class="Magento\Catalog\Block\Product\ProductList\Toolbar" before="-" name="product_list_toolbar" template="Vendor_Catalog::product/list/toolbar.phtml">
                <block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager"/>
             </block>
             <action method="setToolbarBlockName">
                 <argument name="name" xsi:type="string">product_list_toolbar</argument>
             </action>
        </block>
    </referenceContainer>
</body>
</page>

I get:

Cache file with merged layout:
LAYOUT_frontend_STORE1_2d41d8cd98f00b204e9800998ecf8427e and handles :
Please correct the XML data and try again. [] []

Cache file with merged layout:
LAYOUT_frontend_STORE1_20834ceea6c85aca7db01929fe5d8ddb0 and handles
default, m_index_index: Please correct the XML data and try again. []
[]

Cache file with merged layout:
LAYOUT_frontend_STORE1_2a7ccd8094436548b564a588f6303121c and handles
2columns-left: Please correct the XML data and try again. [] []

I tried to give the layout as 3column.

Changed the file to default.xml

For "STORE1_2d41d8cd98f00b204e9800998ecf8427e and handles :" sometimes, doesnt specify which XML, need suggestions to debug this issue

But none helped.

Best Answer

I've encountered this issue before, and Magento doesn't provide much information on what's actually going wrong. As I recall, the name of my layout file didn't match the controller I was looking to use it on, so be sure to check that. If you have a layout file of m_index_index.xml, Magento will attempt to resolve that to a route of {{base_url}}/m/, and a controller of YourModule\Controller\Index\Index.

Related Topic