I'm attempting to create a new page layout for Categories, here's what I have so far:


use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Karl_Subcategories', __DIR__);


    <module name="Karl_Subcategories" setup_version="1.0.0"/>


<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd">
    <layout id="subcategories">
        <label translate="true">Subcategories</label>

So far this is working, I now have a new option within the dropdown for "Custom Design > Page Layout".

But I'm having difficulty trying to define the actual page template which should be used and I'm unable to find much documentation on this.


<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <referenceBlock name="root">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Karl_Subcategories::subcategories.phtml</argument>


echo 'hi';

Any help is greatly appreciated.


You have keep subcategories.xml file inside app/code/Karl/Subcategories/view/frontend/page_layout folder. May be you have mistakes in folder name page_layout not page_layouts. plz check using above folder name and try again.

  • It's definitely supposed to be layouts.xml not layout.xml and page_layouts not page_layout because if I change these the option disappears from the dropdown, although it doesn't look like it's hitting the subcategories.xml file. – Karl Dec 17 '15 at 13:23
  • have you keep folder name page_layout? – Rakesh Jesadiya Dec 17 '15 at 13:26
  • Yes, tried both page_layout and page_layouts – Karl Dec 17 '15 at 13:27
  • you have to keep layouts.xml and page_layout/subcategories.xml file and try. – Rakesh Jesadiya Dec 17 '15 at 13:29
  • I have, still doesn't work. – Karl Dec 18 '15 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.