Magento 2 Custom CMS page layout

We’ve had a request to add a new custom layout for CMS pages in one Magento shop.
This can be very useful and can save you a lot of time for different static pages of your shop.

In this example we’ll create a layout named Sushil Layout.

We should focus on two xml files: layouts.xml and page_layout/sushil -layout.xml under Magento_Theme folder.

Create sushil-layout.xml in:


with content:

<?xml version="1.0" ?>
<layout xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd"> <update handle="empty"/> <referenceContainer name="page.wrapper"> <container name="header.container" as="header_container" label="Page Header Container" htmlTag="header" htmlClass="page-header" before="main.content"/> <container name="" as="page_top" label="After Page Header" after="header.container"/> <container name="footer-container" as="footer" before="before.body.end" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer" /> </referenceContainer>

Our layout is based off the empty page layout, you can also create a layout based another layout.
Just replace <update handle=”empty”/> with the layout you wish to use, e.g <update handle=”3columns”/>

Create layouts.xml in:


with content:

<page_layouts xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd"> <layout id="sushil-layout"> <label translate="true">Sushil Layout</label> </layout>

Now, our custom layout is in the list of layouts.


Note: Clear cache! 😉

The post Magento 2 Custom CMS page layout appeared first on Sushil Kumar.

Do you need any custome Development Click here and fill the form with full your requirement and after i will send the quotes of your work requirements.

About admin

Check Also

Moving the validation error message, this time globally

This blog post is a follow up to my previous blog post, which explained how …

Leave a Reply

Your email address will not be published.