9

I want to add the H1 title along with the description in the description filed for CMS pages and category pages.

How can I remove the H1 title for these pages but keep the H1 title for products pages?

Gordova
  • 347
  • 1
  • 9
  • 18

6 Answers6

19

For removing the tittle from the home page you can just add <referenceBlock name="page.main.title" display="false"/> in your cms_index_index.xml. You can also use display true and false from where you want.

Shine
  • 882
  • 8
  • 15
2

If you just go into the admin and go to content > pages and click edit on home page (or any page), there is a section called design where you can paste in the xml you want to execute. In this case, if you add: <referenceBlock name="page.main.title" remove="true" />

It will remove the title from the home page.

2

Seeing as still nobody's posted what to edit for category pages, the XML file to edit is in /vendor/magento/module-catalog/view/frontend/layout/catalog_category_view.xml. The block to edit is pretty much the same as for CMS pages:

<referenceBlock name="page.main.title" display="false">

user7290573
  • 1,320
  • 1
  • 8
  • 14
0

have you tried in cms_index_index.xml something like this?

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="page.main.title" remove="true" />
    </body>
</page>
Arun
  • 1,609
  • 1
  • 15
  • 18
0

For removing the title from the home page you can just add <referenceBlock name="page.main.title" display="false"/> in your cms_index_index.xml. You can also use display true and false from where you want.

This thing works for me well now:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceContainer name="content">
        <block class="Magento\Cms\Block\Page" name="cms_page"/>
    </referenceContainer>
  <referenceBlock name="page.main.title" remove="true" />
</body>

place this code in cms_page_view.cml

Perazim
  • 1,501
  • 3
  • 19
  • 42
-8

Just add simple css

Get your page class in body and get your page name class with add css like

. Yourpagename .page_title h1 {display:none; }

Your problem is slove simple....

Ashish Patel
  • 772
  • 5
  • 12