CMS Development

a_funs
Contributor

Can you use hubl in email templates?

It is not clear from the documentation. If I can use it, how? Do I just go into the source code of the email and write hubl?

 

For instance, in an email template, I want logic like:

 

{% if contact.membership_type =="member" %}

Say some member stuff

{% endif %}

0 Upvotes
2 Replies 2
Jaycee_Lewis
Community Manager
Community Manager

Can you use hubl in email templates?

Hi, @a_funs 👋 Thanks for your question. The short answer is yes you can. It might look like this (simple example):

{% if contact.membership_type == "member" %}
   <p>Say some member stuff</p>
{% endif %}

 

If you want a quick way to test this out, you can:

  • Navigate to the Design Manager
  • File
  • New File 
  • HTML + HubL
  • Email template 

and experiment from there.

 

If you build something out, and it won't work as expected, adding your example here as a code block helps the community better understand the issue. And I can try inviting some community members to join us as well. 

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

Ryan213
Member

Can you use hubl in email templates?

Thanks. So is this answer outdated? https://community.hubspot.com/t5/Email-Marketing-Tool/HubL-using-custom-contact-properties-in-if-sta...

I want to be able to use `if` statements to show content conditionally based on whether a custom property = "" (empty string) or not. 

I'm having trouble finding the answer in https://developers.hubspot.com/docs/cms/building-blocks/templates/email-template-markup

Thanks!

0 Upvotes