0

app/design/frontend/vendorname/themename/Magento_cms/layout/cms_index_index.xml

<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="logo">
        <arguments>
            <argument name="logo_file" xsi:type="string">images/logo-light.png</argument>
        </arguments>
    </referenceBlock>
</body>

but issue is magento backend side configuration add logo-light.png but cms page logo not visible transpart logo visible

please thanks advance for help

Ravindrasinh Zala
  • 2,125
  • 3
  • 14
  • 46
  • check this link --- https://magento.stackexchange.com/questions/176300/magento-2-alternate-logo-for-page-layout and change run all commands. – Mohit Patel Aug 05 '20 at 16:19

3 Answers3

0

If your image is not in SVG then just upload your image from admin panel

"Content > Configuration > Select Your Current Theme [edit] > Header > Logo Image"

Thanks

Nilesh Dubey
  • 1,077
  • 7
  • 16
0

Default.phtml file

<?php 
     $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
     $storeManager = $objectManager- 
     >get('Magento\Store\Model\StoreManagerInterface'); 
     $currentStore = $storeManager->getStore();
     $mediaUrl = $currentStore- 
     >getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
     $request = $objectManager->get('Magento\Framework\App\Action\Context')- 
     >getRequest();
//var_dump($request-&gt;getFullActionName());

?>

    <div class="header-left offset-md-4 col-md-4">
                <?php if ($request->getFullActionName() == 'cms_index_index'): ?>
                <div class="logo-wrapper <?php echo $logo?"sticky-item":"sticky-item-hidden"  ?>">
                    <?php echo $this->getChildHtml('logo') ?>
                </div>
                <?php else: ?>
                    <div class="logo-wrapper <?php echo $logo?"sticky-item":"sticky-item-hidden"  ?>">
                        <img src="<?php echo $mediaUrl.'wysiwyg/logo-dark.jpg'; ?>" />
                    </div>
                <?php endif; ?>
    </div>
Ravindrasinh Zala
  • 2,125
  • 3
  • 14
  • 46
0

Default.phtml file

      <div class="header-left offset-md-4 col-md-4">
          <div class="logo-wrapper <?php echo $logo?"sticky-item":"sticky-item-hidden"  ?>">
              <?php echo $this->getChildHtml('logo') ?>
              <a href=""><img class="logo-light" src="<?php echo $mediaUrl.'wysiwyg/logo-light.png'; ?>" /></a>
          </div>
  &lt;/div&gt;

_extend.less

.home-page-transparent-header {
.page-header {
    a.logo {
        img {
            display: none;
        }
    }
    &.navbar-fixed-top.keep-header {
        .header-left {
            margin: 0;
        }
        .logo-light {
            display: none;
        }
        a.logo {
            img {
                display: block;
            }
        }
    }
}

}

Ravindrasinh Zala
  • 2,125
  • 3
  • 14
  • 46