Whenever I want to change the layout of a CMS page with a specific layout (here: new-layout), it changes on all CMS pages.


<?xml version="1.0"?>
    <page layout="new-layout" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
            <referenceContainer name="page.top">
                <block class="xx\xx\xx" name="test" template="Xx_Xx::test.phtml"/>

I've only added one page with 'new-layout', but this block gets added on all CMS pages.

  • 2
    You can add new layout for specific page from the backend ,like go to that specific page , edit the page , below you will find design section where you can see text box for layout update xml . add your code over there and it will works . – Manthan Dave Aug 31 '17 at 7:31
  • manthan Dave,please put it as answer – Amit Bera Aug 31 '17 at 8:03
  • @ManthanDave I know. But I want to do it this way. We have multiple dev environments, so that would cost more time. – Cake Aug 31 '17 at 8:52
  • I'm not sure there is a layout handle for specific CMS pages other than home. cms_index_index.xml or cms_index_index_id_home.xml however none for the other pages it seems. – harri Aug 31 '17 at 9:38
  • AmitBera i guess @harri is trying to do this on another manner ,so lets keep in comment only – Manthan Dave Aug 31 '17 at 9:40

Your Answer

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

Browse other questions tagged or ask your own question.