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

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.

| improve this answer | |
  • 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? – Sophie Baxter Jul 13 '16 at 8:44

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.