Magento 2 remove page title
Today we talk about how in Magento 2 remove page title. In this tutorial we will learn how to remove page title that are shown under top menu navigation. We will remove the page title by xml layout file. If you want to remove on all page create a default.xml or you want to remove title for a specific page for example product view page catalog_product_view.xml. So let’s start with our example to remove for all pages.
Remove Title From all Pages in Module
First create the default.xml in QaisarSatti/HelloWorld/view/frontend/layout/
<?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>
<referenceBlock name="page.main.title" remove="true" />
</body>
</page>
<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>
Remove Title From all Pages in Theme
First create the default.xml in QaisarSatti/theme/Magento_Theme/layout/
<?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>
<referenceBlock name="page.main.title" remove="true" />
</body>
</page>
<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>