2

I had tried to remove title from cms pages so used referenceBlock name="page.main.titlte" remove="true" on cms_index_index.xml but it removed title from product and category pages too.

How can i get the title back? Tried removing the above code but no luck.

1

What you say is the problem cannot be the problem. If you remove it from the layout then it will not affect the other pages. You must have removed it somewhere else too. Likely default.xml.

0

It's because some of category pages use cms handle also, and IF checkbox apply design to products set in category, product page will also use this handle. So possible solution here is write custom title block which wrap original one or use plugin on current and check if it is cms page before render html.

0

Create cms_page_view.xml in your theme :

/app/design/frontend/Vendor/YourTheme/Magento_Cms/layout/cms_page_view.xml

Add below code in XML

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="page.main.title" remove="true"/>
</body>
</page>

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.