0

Developing a new frontend using BS5, the issue with the layout XML keeps breaking, the footer HTML markup not coming altogether any clue?

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>

        <!-- Header -->
        <referenceContainer name="header.container" htmlClass="header">
            <!-- Header Content -->
            <container name="header.content" htmlClass="content" htmlTag="div" />
        </referenceContainer>
        <!-- <referenceContainer name="header.content" htmlClass="content" /> -->

        <referenceBlock name="top.links">
            <arguments>
                <argument name="css_class" xsi:type="string">top-links</argument>
            </arguments>
        </referenceBlock>

        <referenceContainer name="page.top">
            <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600" before="-"/>
        </referenceContainer>

        <!-- Main -->
        <referenceContainer name="main.content"/>

        <!-- Footer -->
        <referenceContainer name="footer.container" htmlClass="footer">
            <!-- Footer Content -->
            <container name="footer.content" htmlClass="content my-3" htmlTag="div">
                <container name="footer.row" htmlTag="div" htmlClass="row">
                    <container name="footer.newsletter" htmlTag="div" htmlClass="col-xs-12 col-md-6 col-lg-3 order-md-2" />
                    <container name="footer.navigation" htmlTag="div" htmlClass="col-xs-12 col-md-6 col-lg-9 order-md-1">
                        <block class="Magento\Cms\Block\Block">
                            <arguments>
                                <argument name="block_id" xsi:type="string">footer_navigation</argument>
                            </arguments>
                        </block>
                    </container>
                </container>
            </container>
        </referenceContainer>

        <!-- Removing Magento Native Blocks -->
        <referenceBlock name="my-account-link" remove="true"/>
        <referenceBlock name="register-link" remove="true"/>
        <referenceBlock name="currency" remove="true" />
        <referenceBlock name="navigation.sections" remove="true" />
        <referenceBlock name="footer_links" remove="true" />
        <referenceContainer name="header.panel.wrapper" remove="true" />

        <!-- Moving Elements to the new Containers -->
        <move element="logo" destination="header.content" before="-" />
        <move element="minicart" destination="header.content" after="logo" />
        <move element="top.search" destination="header.content" after="minicart" />
        <move element="top.links" destination="header.content" after="-" />
        <!-- <move element="footer_links" destination="footer-links-container" /> -->
        <move element="form.subscribe" destination="footer.newsletter" />
        <!-- <move element="store_switcher" destination="footer-tools-container" /> -->
        <move element="copyright" destination="footer.content" after="-"/>
        <!-- <move element="report.bugs" destination="footer-legal-container" /> -->

    </body>
</page>
1
  • It seems the footer comes back if I change the name from "footer.container" to "footer-container", any clue? – Ibrahim S Mar 4 at 3:44
0

I figured the issue, is basically I am using referenceContainer tag which is by definition a reference to an existing container, and since I have not created the container in the first place, it was not matching therefore it never been rendered.

I have figured that I must define the container in the page_layout, and in my case, it was page_layout/1column.xml

I hope this helps anyone who might have a similar issue.

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.