3

This seems like a really basic question, but i want to change the page layout for 1-column pages created in the CMS, how do i do this without changing the layout of the homepage?

To change the homepage i've overriden cms_index_index.xml, and added additional blocks. I want to do the samething for all other 1 column pages, but they need a different wrapper class as follows:

<referenceContainer name="main.content" htmlClass="page-main wrapper">
            <container name="main.content.inner" htmlTag="div" htmlClass="wrapper-inner wrapper-inner--condensed" />
        </referenceContainer>

I'm overriding cms_page_view.xml. Am i overriding the correct file because the above change isn't being picked up?

2 Answers 2

2

Yes, cms_page_view.xml is the right file:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content" htmlClass="test">

Make sure that the container you reference is actually on the page.

1
  • Hi, I'm trying to add a wrapper container around the content, i've added the following: <referenceContainer name="content"> <container name="main.content.inner" htmlTag="div" htmlClass="wrapper-inner" before="-"> </container>></referenceContainer> is this how would add a container to the layout? I'm also trying to add a block for a custom page banner <block class="Magento\Cms\Block\Block" name="page.main.banner" template="Amrita_Cms::banner.phtml" before="-" /> neither are working, can you tell me if i'm misunderstanding something? Commented Jul 13, 2016 at 8:44
0

I have created a page containing a list of filtered product collection via CMS, a 2 column one. Layered navigation is not appearing in left side bar for the page (layered navigation is enabled). I am looking for a solution and came across this. Going to try overriding cms_page_view.xml :) . If anyone has previous experience on this please let me know. I m using Magento v 2.4 .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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