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