When creating Marketo email templates for non-developers to use, we need to rely on them not needing to click the "Edit HTML" button to correct a color or style, and it would be preferred for them to not need to refer to a list of color codes to make sure they get it right if they resort to the color picker.
We can include placeholder content in a module that has the correct inline styles and colors for an example link, where we could even use a variable in the module to allow them to select from a specific palette of three or four colors.
But if they paste over the placeholder content, those inline colors or any Marketo syntax variables are lost.
ex:
<strong>Bold text,</strong> <em>italic text,</em> and <a href="https://internet.c?mt={{program.id}}" style="color: ${module-link-color};"><strong>link text</strong></a>.
after pasting in their own content becomes:
The future's up to you<br />So what you <a href="#" target="_blank" id="">gonna do</a>?<br />
abandoning the inline style, which could be a color or a variable:
style="color: ${module-link-color};"
My workaround when editing content myself is to copy/paste the link from the placeholder content, and then modify the copy and link destination, which maintains the inline style, and I can correct the styles for the non-devs after copy goes through the approval process, but that adds more steps to the process. Also, we can't count on non-devs to perform an unintuitive sequence of copy/pastes just to maintain an inline link style.
We also can't use the "inline css" feature, because that breaks the template and makes the modules in the Modules tab inaccessible.
Are there no good choices here?
My next step would be to build a standalone Marketo paragraph builder that provides an intermediate where non-devs can edit copy and then paste the code into Marketo.
Thanks!
Solved! Go to Solution.
You put the JS in the email template (just loading a remote <script src>
, no need to have it be inline).
Hook the TinyMCE events. Alter any <a>
before saving.
Then you use Velocity only to make sure the <script src>
isn't injected into the final rendered email.
You might think about using a class like "text-link" on the parent element (<table> in this example) and writing some CSS in a <style> tag in the <head> of your document to style the links. You can use the mktoModuleScope="" attribute to either make these variables bound to the modules or globally to all links on the template.
Here's an idea of what a CSS class might look like:
.text-link a, .text-link a:visited, .text-link a:link {color: ${em_linkColor} !important; text-decoration: ${em_linkDecoration}; font-weight:${em_linkWeight};}
... and here's a look at the implementation on the parent <table> element around the editable <div> (paragraph).
<table role="presentation" class="text-link" width="100%" border="0" cellpadding="0" cellspacing="0" style="min-width:100%;">
<tr>
<td>
<div role="paragraph" class="mktoText" id="paragraph.p" mktoName="Paragraph" style="font-family:${em_fontFamily_body}; font-size:${p_fontSize}px; line-height:${p_lineHeight}px; font-weight:${p_fontWeight}; text-align:${p_textAlign_left}; color:${p_color};">
Paragraph lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Quis ipsum suspendisse ultrices gravida. Risus commodo viverra maecenas accumsan lacus <a href="#" target="_blank">sample link</a>.
</div>
</td>
</tr>
</table>
If you'd like to make life easy on the marketers, you could create a few of these classes, lets say "text-link-red" and "text-link-blue" and "text-link-yellow" in your <style> tag. Then you could add a .mktoList (dropdown) variable that extends the class on the <table> element -- for example, you'd set your .mktoList variable like this:
<!-- default = red | values = red, blue, yellow | optional: mktoModuleScope = true/false -->
<meta class="mktoList" id="text-link-color" mktoName="Link Color" default="#FF0000" values="#FF0000, #0000FF, #FFFF00" mktoModuleScope="false">
With that new list variable created, you could update the class on the <table> element to look something more like this:
<table role="presentation" class="text-link-${text-link-color}" width="100%" border="0" cellpadding="0" cellspacing="0" style="min-width:100%;">
... and your CSS to look something more like this:
.text-link-red a, .text-link-red a:visited, .text-link-red a:link {color: #FF0000 !important; text-decoration: ${em_linkDecoration}; font-weight:${em_linkWeight};}
.text-link-blue a, .text-link-blue a:visited, .text-link-blue a:link {color: #0000FF !important; text-decoration: ${em_linkDecoration}; font-weight:${em_linkWeight};}
.text-link-yellow a, .text-link-yellow a:visited, .text-link-yellow a:link {color: #FFFF00 !important; text-decoration: ${em_linkDecoration}; font-weight:${em_linkWeight};}
If you wanted to take this to the next level, you could also use variables in place of the fixed color codes in your classes, and just set the default="" value for each of the variables to the red, blue, yellow colors. This would open the options back up to the end-user to be able to change the "text-link-blue" class to something like a pink color value, so maybe in your situation it'd be best to create a class for each of your branded link colors, give them a colorName (like red, blue, yellow) and then use those values to populate the list variable values so it's easy to read (red vs #FF0000).
NOTE: This would probably mean you'd need to refactor the code for your modules on your template which in turn would mean you'd need to add a new module to your layouts to replace the old setup but this might be something to consider in moving into the future w/ your email development standards in terms of optimizing for the end-user in your process.
I think one concern using css or html styles that aren't inline on the <a> is consistency across email clients that might ignore the separate css defined in the <style> tags, but it would be worth giving a try.
Well, how good is your JavaScript? 😎
(You can write a hook that automatically adds the styles to new links.)
I was thinking of even building a Chrome extension and Firefox plugin to solve for this.
Does Marketo have its own JS interface for working with email template HTML?
If so, it isn't mentioned in their Email Template Syntax KB.
This would be only be for Email templates.
Since it only appears Velocity Script may be used to parse the message with some sort of regex replacement at deployment, and none of those changes would be visible while composing the message, that solution wouldn't work for the more visual non-devs who are building the messages.
Thanks
You put the JS in the email template (just loading a remote <script src>
, no need to have it be inline).
Hook the TinyMCE events. Alter any <a>
before saving.
Then you use Velocity only to make sure the <script src>
isn't injected into the final rendered email.
In the context of Marketo Designer, the result of adding javascript, either inline or with an external file, results in the error:
"Marketo does not allow javascript or script tags in email HTML
Please refresh your browser."
There are some posts marked as a solution for this where characters from the script tag are html encoded and go undetected by the validator, but this simply displays the script tag literally, unable to actually load the script.
? Works fine as described.
Can you elaborate on how this demo was created?
Adding a <script> tag anywhere in an existing email template results in the error I listed previously, and the HTML will not validate.
Are you perhaps adding the tag within wysiwyg region and not directly to the template?
Thanks
<head>
of a template, nothing special.
Perhaps we are communicating about different types of Marketo templates, or we are using a different version of Marketo.
When editing the HTML of an email template, adding a <script> tag anywhere within the template, including within the <head>, results in the same validation error when saving of validating.
"Limited Access
Marketo does not allow javascript or script tags in email HTML
Please refresh your browser."
Is there an admin setting to disable the validation? I see the title of the error window is "Limited Access".
Thanks
I'm simply creating a template and approving it. Naturally I have Admin access to all my instances but nothing else special.
Perhaps you're getting caught up on the validation warning, but this doesn't stop approval.
Thanks!
Now we are cooking 🧑🍳👨🍳👩🍳
I was getting hung up on the validation error, because I was editing the HTML of a test email when testing the <script> tag and not the HTML of a base Template. When selecting Approve & Close on a Template, there is no forced validation, and the script executes when using the template in a new message.
Now I wonder how much longer Marketo will be sticking around for us to make use of these enhancements I'm about to add 😬