Magento 2 Frontend - Page Layout
Page Layouts are formats in magento that enable us to use the structure of the basic html and css, javascript without much effort. These are the basic page layouts by magento default for frontend.
- checkout
- 1column
- 2columns-left
- 2columns-right
- 3columns
- empty
in admin, these are the default.
- admin-1column
- admin-2column
- admin-empty
- admin-login
- admin-popup
Even the empty page layout is one of the default page layouts. If you would select a page layout which is different to these default page layouts, Without further explanations, these are the variables loaded in the page layouts. These variables can be seen in the result page in the render function.
- $htmlAttributes
- $headAttributes
- $requireJs
- $headContent
- $headAdditional
- $loaderIcon
- $bodyAttributes
- $layoutContent
The empty layout has containers as we can see in the xml file empty.xml
root
after.body.start
page.wrapper global.notices
main.content
columns.top
columns
main
page.bottom.container
before.body.end
But we don’t see the content container, which we added for the full action handle(modulename_controllername_actionname) for the reference container. It is added by the default layout handle, but we can see that the default layout handle relies on the main container, which would not be there for more_empty.xml.
// vendor/magento/module-theme/view/frontend/layout/default.xml
<referenceContainer name="main">
<container name="content.top" label="Main Content Top" />
<container name="content" label="Main Content Area" />
<container name="content.aside" label="Main Content Aside" />
<container name="content.bottom" label="Main Content Bottom" />
</referenceContainer>