When creating an html email template, can you add a <style> block based on a module? | Community
Skip to main content
Level 1
April 2, 2020
Solved

When creating an html email template, can you add a <style> block based on a module?

  • April 2, 2020
  • 1 reply
  • 2611 views

Hi guys. I'm creating an html template in Marketo. For one of my modules there's quite a chunk of css styles that need to go in the <head> section. Is there a way to only show certain <style> blocks based on whether or not a certain module is being used in the template? The extra <style>'s do not need to be shown if I'm not using the module and there's quite a few lines of them so I don't really want them there if I'm not using the corresponding module, if that makes sense?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Not if the styles must be in the <head> - and styles need to be in the <head> to work across mail clients (where they are supported at all).

 

For content other than styles, you could include a Velocity token in the module that sets a variable. And then in another Velocity token, check to see if that variable is set and output the content if so. But for this to work, the output token would need to come after the modules in the HTML.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
April 2, 2020

Not if the styles must be in the <head> - and styles need to be in the <head> to work across mail clients (where they are supported at all).

 

For content other than styles, you could include a Velocity token in the module that sets a variable. And then in another Velocity token, check to see if that variable is set and output the content if so. But for this to work, the output token would need to come after the modules in the HTML.

JulzAuthor
Level 1
April 2, 2020

Ok thank you this makes sense. Shame there's no way to do it but good to know about adding in a token that sets a variable, could be handy in the future.