SOLVED

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

Go to solution
Julz
Level 1

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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

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

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.

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

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

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.

Julz
Level 1

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

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.