Question

I created a new page layout for my home page. I want it to display 3 blocks next to each other.

It should look like this:

enter image description here

I created the blocks in backend but with the below code they don't show up.

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

    <referenceContainer name="columns">
        <!-- 
        <container name="div.sidebar.main" htmlTag="div" htmlClass="sidebar sidebar-main" after="main">
            <container name="sidebar.main" as="sidebar_main" label="Sidebar Main"/>
        </container>
        <container name="div.sidebar.additional" htmlTag="div" htmlClass="sidebar sidebar-additional" after="div.sidebar.main">
            <container name="sidebar.additional" as="sidebar_additional" label="Sidebar Additional"/>
        </container>

        <container name="fourth.column" htmlTag="div" htmlClass="fourth-column" after="-">
            <block class="Magento\Framework\View\Element\Text">
                <arguments>
                    <argument name="text" xsi:type="string">Nummer 3</argument> 
                </arguments>
            </block>
        </container>
        -->

        <container name="column1" htmlTag="div" htmlClass="column-float-left" after="-">
          <block class="Magento\Cms\Block\Block" name="startseite_links">
            <!-- 
            <arguments>
                <argument name="startseite_links" xsi:type="string">cmsblock-identifier</argument>
            </arguments>
            -->
        </block>
        </container>

        <container name="column2" htmlTag="div" htmlClass="column-float-left" after="-">
          <block class="Magento\Cms\Block\Block" name="startseite_mitte">
            <!--
            <arguments>
                <argument name="startseite_mitte" xsi:type="string">cmsblock-identifier</argument>
            </arguments>
            -->
        </block>
        </container>

        <container name="column3" htmlTag="div" htmlClass="column-float-left" after="-">
          <block class="Magento\Cms\Block\Block" name="startseite_rechts">
            <!--
            <arguments>
                <argument name="startseite_rechts" xsi:type="string">cmsblock-identifier</argument>
            </arguments>
            -->
        </block>
        </container>

    </referenceContainer>

</layout>

Any idea why this is happening?

Thanks for any help!

Was it helpful?

Solution

According to the requirement you are telling you can achieve it by 2 methods:

Method 1: You can paste the below content in your CMS homepage:

{{block class="Magento\Cms\Block\Block" block_id="block_1"}}
{{block class="Magento\Cms\Block\Block" block_id="block_2"}}
{{block class="Magento\Cms\Block\Block" block_id="block_3"}}

This will show all your CMS static blocks**(block_1,block_2 and block_3)** together in the CMS homepage content area.

Method 2:

You can merge the contents of 3 CMS static blocks**(block_1,block_2 and block_3)** and paste the html into your CMS homepage content area.

Both will work same.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top