3

I am tweaking my theme using the xml approach.

I have this xml code:

<referenceBlock name="logo">
    <arguments>
        <argument name="logo_file" xsi:type="string">images/my-override-logo.png</argument>
        <argument name="logo_img_width" xsi:type="number">160</argument>
        <argument name="logo_img_height" xsi:type="number">240</argument>
        <argument name="logo_img_alt" xsi:type="string">Alt string for SEO and Accessibility purposes</argument>
    </arguments>
</referenceBlock>

My alt string is not correctly coded because I can't get the alt attribute string to render to the page. Any suggestions?

3 Answers 3

0

not 100% sure about this, but it looks like they changed the key to logo_alt and did not update it in the themes: https://github.com/magento/magento2/blob/develop/app/code/Magento/Theme/Block/Html/Header/Logo.php#L78

So it will take the value from the backend configuration if nothing else is defined for logo_alt

0

There is an alternative option to do it via admin:

Navigate in admin Stores->Design->Header->Logo Image Alt = 'Put your desired title'

save the config and refresh the cache it's done.

0

I had the exact same problem and did not find any documentation about this online.

To solve it using the XML approach you can use "logo_alt" like this :

<argument name="logo_alt" xsi:type="string">Alt string for SEO and Accessibility purposes</argument>

This is working for sure with Magento 2.2.5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.