0

I try this solution but i can not get custom _home layout according your answer so please help me to solve this problem.

I tried this link and put you layout.xml code on this location `D:\wamp64\www\magento\app\design\frontend\Magento\Custom\Magento_Theme'

and added ypur custom_home.xml code on this location D:\wamp64\www\magento\app\design\frontend\Magento\Custom\Magento_Theme\page_layout

0

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

Create homepage-layout.xml in:

app/design/frontend/_YOUR_VENDOR_/_YOUR_THEME_/Magento_Theme/page_layout/homepage-layout.xml

with content:

<?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">
    <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="page.top" 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>
</layout>

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:

app/design/frontend/_YOUR_VENDOR/_YOUR_THEME_/Magento_Theme/layouts.xml with content:

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

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

Clear cache :)

PS. this is from my post Magento 2 Custom CMS page layout

  • Hi, I all ready add this to file , but still not showing custom layout – kishan Jul 21 '17 at 11:12
  • Run setup static deploy and clear cache :) – Matej Đaković Jul 22 '17 at 11:58

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.