0

Magento does not support loading svg through admin panel, so i am trying to change the website logo through code.

My logo is here:

public/app/design/frontend/Name/Name_theme/web/images/my-logo.svg

I changed the file name here:

public/app/design/frontend/Name/Name_theme/Magento_Theme/layout/default.xml

it now looks like this:

<block class="Magento\Theme\Block\Html\Header\Logo" name="logo">
    <arguments>
        <argument name="logo_img_width" xsi:type="number">147</argument>
        <argument name="logo_img_height" xsi:type="number">24</argument>
        <argument name="logo_image_src" xsi:type="string">images/my-logo.svg</argument>
    </arguments>
</block>

I deleted the cache using the command:

rm -rf public/var/cache

But this does not seem to help and my logo is not displaying.

Are there any other ways i can achieve this?

  • 2
    Please post a question or translate in English. – Aditya Shah Oct 12 '18 at 11:12
  • I'm voting to close this question as off-topic because of language – Amit Bera Oct 12 '18 at 11:46
  • @AmitBera we have successfully translated question – Murtuza Zabuawala Oct 12 '18 at 12:01
  • 1
    ha ha , You used google. I have wait for user update – Amit Bera Oct 12 '18 at 12:02
  • Yes @AmitBera used google translate :) – Murtuza Zabuawala Oct 12 '18 at 12:05
2

it is recomended do not change the vendor files so. in default.xml file paste this code and create web/images/logo.png file

<?xml version="1.0"?>
<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">
            <action method="setLogoFile">
                <argument name="logo_file" xsi:type="string">
                    images/logo.png
                </argument>
            </action>
        </referenceBlock>
        <referenceBlock name="logo" remove="true" />
    </body>
</page>

clean the cache and reload the page

| improve this answer | |

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.