0

Recently I decided to create a custom layout like column1-without-sidebar or something.

I just want catalog->category page with the header and footer but without the sidebar etc.

So Any ideas what I'm doing wrong? Also I wonder where the default Magento 2.1 column1,2,3 layout is located?

I created a file named smakenLayout.xml in the /magento2/app/design/frontend/Smartwave/MY_THEME/Magento_Theme/layout. The code is as follow(taken from magento.stackechange):

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

Another file which was to declare the smakenLayout.xml was made and put in the main Magento-theme folder: /magento2/app/design/frontend/Smartwave/MY_THEME/Magento_Theme/. The code is as follow:

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

If you want to make the category page have no sidebars, you can just change the page layout to 1column. To do this make the file {theme_directory}/Magento_Catalog/layout/catalog_category_view.xml with this code:

<?xml version="1.0"?>

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

</page>

The different layouts can be found in vendor/magento/module-theme/view/frontend/page_layout/.

If instead you want to make a new page layout, you'd put smakenLayout.xml in {theme_dir}/Magento_Theme/page_layout/, not {theme_dir}/Magento_Theme/layout/.

| improve this answer | |
  • I already tried to change to different column layouts in the admin panel but I still get html content from the sidebar. Also, I only want to remove the sidebar in 1 category page. So I geuss I have to make a new page layout, don't I? EDIT: page_layout doesn't exist in my theme's directory structure only layout. – Mustafa Tosuncu Mar 21 '17 at 10:29
  • If you want to change the layout for just the one category, in admin panel go to that category and under Design > Layout select 1 column. You need to create the page_layout directory if it doesn't exist. – Aaron Allen Mar 21 '17 at 10:33
  • It worked! I put the smakenLayout.xml in the newly created page_layout and it worked ! BUT, I don't understand why it worked now because in the 1 column layout, some of the sidebar content transferred to main column and when I chose 1column with sidebar, the same content that transferred was also in the sidebar. So what exactly did I do different this time? In the smakenLayout file I used empty as layout. I geuss If I choose 1column again I will get the same issue as before but why? – Mustafa Tosuncu Mar 21 '17 at 10:48

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.