1

I have specified a custom logo in <custom-theme-dir>/Magento_Theme/layout/default.xml as so, and uploaded the logo image file to <custom-theme-dir>/web/images/theme_logo.png, but the logo does not show up on the front end:

<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_src" xsi:type="string">images/theme_logo.png</argument>
            <argument name="logo_width" xsi:type="number">210</argument>
            <argument name="logo_height" xsi:type="number">30</argument>
            <argument name="logo_alt" xsi:type="string">My Theme Co.</argument>
        </arguments>
    </referenceBlock>
</body>

The other parameters (width, height, alt text, etc. all show up in the image tag, but the source stays exactly as specified in default.xml.

Other sites I've worked with make a replacement in the image source attribute pointing to the static file location, but for some reason, this "conversion" in the src path is not happening.

What I'm seeing in the page source code:

<img src="*images/theme_logo.png*" title="My Theme Co." alt="My Theme Co." width="210" height="30">

What I expect to see:

<img src="*https://example.com/static/versionXXXXXXXXXXX/frontend/<Vendor>/<custom-theme-dir>/en_US/images/theme_logo.png*" title="My Theme Co." alt="My Theme Co." width="210" height="30">

I've tried blowing away the static content, changing from developer mode to production mode and default mode, etc. and completely re-caching everything, re-indexing, etc. and there is no change. The logo does not show up because it seems that the logo file is not being transferred over to the static content.

Why is this likely not happening?

I've consulted several resources including:

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/themes/theme-create.html#theme_logo

Replace logo.svg in default.xml not working Magento2

store logo in not loading

  • Upload logo from magento backend , theme, html , logo upload. – Hamendra Sunthwal Apr 9 at 17:22
  • did you find a solution? I'm having the exact same problem – BETSCH May 22 at 11:16
  • @BETSCH See Sam Tyler's answer below. Did the trick for me. Good Luck. – Greg Nickoloff May 26 at 18:09
0

The first argument needs to be logo_file instead of logo_src. So the whole line would be:

<argument name="logo_file" xsi:type="string">images/theme_logo.png</argument>

Notes:

The documentation is incorrect as of the time of writing. There's a PR to fix it.

Edit: The PR is accepted and the documentation is now correct.

| 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.