In my Magento 2 (CE ver. 2.4.7) custom theme's Magento_Catalog module's initial landing page, there's a block positioned in the header area called "logo" (this is the block that creates and positions the default Magento logo image). I'm struggling with how to remove the logo block from this Magento_Catalog page. (Note my custom theme's parent is the default "blank" theme).
Now, I traced the inheritance source for the logo block back to Magento 2's base Magento_Theme module. You can see the key section below for this initial block definition in the file : /magento2/vendor/magento/module-theme/view/frontend/layout/default.xml :
<container name="header-wrapper" label="Page Header" as="header-wrapper" htmlTag="div" htmlClass="header content"> <block class="Magento\Theme\Block\Html\Header\Logo" name="logo">
<arguments> <argument name="logoPathResolver" xsi:type="object">Magento\Theme\ViewModel\Block\Html\Header\LogoPathResolver</argument> <argument name="logo\size\resolver" xsi:type="object">Magento\Theme\ViewModel\Block\Html\Header\LogoSizeResolver</argument> </arguments>
</block>
</container>
Initially, I tried to remove this logo block with a "referenceBlock name="logo" remove="true" " statement in each of my custom theme's Magento_Catalog's two main layout files (default.xml, and then catalog_category_view.xml ) -- but neither approached worked: the logo block and image remained on the page.
And so in response, because this block was initially created in the default.xml page of the /magento2/vendor/magento/module-theme/view/frontend/layout folder, I instead turned to creating a new default.xml file in my custom theme's Magento_Theme/layout folder (and then added to that file the declaration:
<referenceBlock name="logo" remove="true" ... </referenceBlock>
-- but that also did not work. After always doing a cache:clean and redeploy of static content, on page refresh, the image (and its block) remained on the page.
And so instead, in the same file, I tried removing the container element wrapping that logo block ("header.wrapper") -- but that also didn't work. And so despite all the efforts that I believe were well guided, the default Magento logo remains in the header section of my custom theme's Magento_Catalog's initial landing page.
What did I do wrong? Why was this removal of the logo block not successful? What else can I do?
Hello @mailfortdg4957
Review below steps for remove "Logo" Block from Magento_Catalog's Initial Landing Page:
Open file: app/design/frontend/Vendor/Theme/Magento_Catalog/layout/catalog_category_view.xm
If you wish to remove only logo:
<?xml version="1.0"?> <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> <referenceBlock name="logo" remove="true"/> </body> </page>
If you wish to remove header block:
<?xml version="1.0"?> <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> <referenceBlock name="header-wrapper" remove="true"/> </body> </page>
If you wish to remove full header:
<?xml version="1.0"?> <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> <referenceBlock name="header.container" remove="true"/> </body> </page>
Hope it helps !
If you find our reply helpful, please give us kudos.
A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.
WebDesk Solution Support Team
Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Thank You,
WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Location: 150 King St. W. Toronto, ON M5H 1J9