Magento 2.2 – Move Category Title Above Description

categorylayoutmagento2template

I'm just diving into template/block/layout customization in Magento 2.2 and I'd like to move my category title from being left aligned to being aligned above the description.

Currently it's like this:

_________________________________
|                               |
| Page Title                    |
|_______________________________|
|          |                    |
|(sidebar) | (main content)     |
|          |                    |
|          |                    |
|__________|____________________|

I'd like for it to be like this:

_________________________________
|          |                    |
|          | Page Title         |
|          |                    |
|(sidebar) | (main content)     |
|          |                    |
|          |                    |
|__________|____________________|

Thank you.

Best Answer

There are two ways to achieve this.

  1. If you want it to affect all of your category pages for that create your own theme at below location

app/design/frontend/Package/theme in that create a file with name catalog_category_view.xml at below location

app/design/frontend/Package/theme/Magento_Catalog/view/frontend/layout

And put this code there in the file catalog_category_view.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <move element="columns.top" destination="content" before="-"/>
    </body>
</page>
  1. To just have this change in to a single category do following tasks

Just go to you admin & traverse at below location

Catalog > Category > Your Category > Design

At there do following changes

  • set Layout > 2 Columns with left bar
  • Put below content at Layout Update XML
<page>
    <body>
       <move element="columns.top" destination="content" before="-"/>
    <body>
</page>

If still facing some issue do mention below

Note: Don't forget to make catch disabled when doing this task otherwise perform the following command into your terminal from your magento root directory

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f

Thank You Happy Coding!