Setting the Alt attribute for images elements in Guided LPs

Grégoire_Miche2
Level 10

Setting the Alt attribute for images elements in Guided LPs

It is currently impossible of the standard user to set the ALT attribute on mktoImg elements in landing pages. You will have to use workarounds that need to be anticipated in the Guided Landing Page template you are using.

To create a mktoImg element in an LP template, you can use either a <div> or an <img> tag in the template (see the doc here Create a Guided Landing Page Template - Marketo Docs - Product Docs )

  • in the <div> case, the final <img> tag will be entirely generated by Marketo. You could set the alt attribute in another hidden <div> with a variable and have some JS using this <div> value to set the tag.
  • in the img case, you have a little more control. You can use the img tag with a variable to set the alt <img class="mktoImg" id="exampleImg" mktoName="Example Image" alt="${MyImgAltVariable}">

All of this is not very usable, though, so I also have added the idea of an easy alt setting here :

Anything I have missed? Any other idea to workaround this limitation?

-Greg

2 REPLIES 2
Grégoire_Miche2
Level 10

Re: Setting the Alt attribute for images elements in Guided LPs

Hi Justin Cooperman​,

Any chance to have this fixed in the future ?

-Greg

Homero_Cavazos
Level 2

Re: Setting the Alt attribute for images elements in Guided LPs

Greg,

Have you tried the following?

<div id="header-image" class="mktoImg" mktoName="Header Image" alt="${heroAltText}">

         <img src="../image.jpg" >

</div>

This works fine when Marketo generates the image tag with it's attributes. Just make sure you include the declaration in the head of the HTML like:

<meta class="mktoString" id="heroAltText" mktoName="Hero Alt Text" default="Header Image" allowHtml="false">