Magento2 by default provide 1column, 2columns-left, 2columns-right, 3columns layout and I want to set new layout for my Homepage so I do below process.

First copy 2 files from this path

1. magento2_root ->vendor -> magento -> module-theme -> view -> frontend -> page_layout folder

2. magento2_root ->vendor -> magento -> module-theme -> view -> frontend -> layouts.xml

after copy these files I paste these file to below place and change as per my custom layout

3. app -> design -> frontend -> my_vendor -> my_theme -> magento_theme -> page_layout folder

4. app -> design -> frontend -> my_vendor -> my_theme -> magento_theme -> layouts.xml

in the page_layout folder I create new XML file homepage.xml and code for this file is below.

<?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" />

in the layouts.xml file I put below code.

<?xml version="1.0" encoding="UTF-8"?>
<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd">
<layout id="homepage">
<label translate="true">Home Page</label>

so after done with this files I get new custom home page layout in cms page -> Home page -> design tab - > layout

enter image description here

now I go to frontend home page and it shows me blank homepage.below is my homepage image after assign custom homepage`

enter image description here

when I check the source code for the homepage I show that page is break after body tag and below is my homepage source code.

<html lang="en-GB">
<head >
 var require = {
    "baseUrl": "http://fp.devdemo.in/pub/static/frontend/Forever/theme/en_GB"
<meta charset="utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="description" content="Default Description"/>
<meta name="keywords" content="Magento, Varien, E-commerce"/>
<meta name="robots" content="INDEX,FOLLOW"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
<link  rel="stylesheet" type="text/css"  media="all" href="http://fp.devdemo.in/pub/static/frontend/Forever/theme/en_GB/mage/calendar.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://fp.devdemo.in/pub/static/frontend/Forever/theme/en_GB/css/styles-m.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://fp.devdemo.in/pub/static/frontend/Forever/theme/en_GB/css/styles.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://fp.devdemo.in/pub/static/frontend/Forever/theme/en_GB/Solwin_FeaturedPro/css/featuredpro.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://fp.devdemo.in/pub/static/frontend/Forever/theme/en_GB/Solwin_FeaturedPro/css/owl.carousel.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://fp.devdemo.in/pub/static/frontend/Forever/theme/en_GB/Solwin_FeaturedPro/css/owl.theme.css" />
<script  type="text/javascript"  src="http://fp.devdemo.in/pub/static/frontend/Forever/theme/en_GB/requirejs/require.js"></script>
<body data-container="body" data-mage-init='{"loaderAjax": {}, "loader": { "icon": "http://fp.devdemo.in/pub/static/frontend/Forever/theme/en_GB/images/loader-2.gif"}}' class="cms-index-index page-layout-homepage">

so do anyone have any idea?

  • You try to remove Layout Update XML <block class="MageStore .....</block>? And check any errors in exception log? – Khoa TruongDinh Jun 4 '16 at 11:50
  • @watson how you fix it ? i am also stuck on this – Maninderpreet Singh May 28 '18 at 4:13
  • Was this issue resolved? Even I am facing the same issue. – Bridgit Thomas Jul 4 '18 at 8:20

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.