Introducing Handlebars Merge Language for Pardot: Ensure Perfect Personalization Every Time

Every time I get an email with an obvious blank field or junk data such as “Hi First Name,” I can’t help but try to figure out where things went wrong for the sending marketer. As the product manager for email at Pardot, I am obsessed with great, personalized marketing and I’m committed to ensuring that these mistakes don’t happen for our customers and recipients get the right message every time.

That’s why I’m excited to introduce Handlebars Merge Language (HML) for Pardot. HML is a new merge language for personalizing email in Pardot. It’s easy to upgrade your content, search for the fields you need and the language is shared by Salesforce Lightning Templates, laying the foundation for more email compatibility down the road.

HML improves personalization by adding a new tool to your arsenal for delivering tailored content to your prospects: the #if statement. Using an #if statement allows you to check whether a field has data directly in the email. When you know whether the data is present, you can then provide the optimal content for both cases.

Let’s take a look at how HML is helping marketers create better customer experiences with perfect personalization and relevant offers.

Avoid Personalization and Grammar Mistakes

Let’s say you want to use your recipient’s first name in your email greeting, like “We’ve got good news for you, Heather!”

If you don’t know your recipient’s first name, it’s hard to avoid the all-too-common personalization and punctuation fail, “We’ve got good news for you, !” 

One option could be to use a global default like “Friend” or “Customer,” but that might feel too unnatural. What if we just left it out completely, but made sure the punctuation looked right?

Here’s how you can solve this with #if:

{{#if Recipient.FirstName}}! // First we’ll check for the first name
We’ve got good news for you, {{Recipient.FirstName}}! // Here’s the content if we have a First Name
{{else}} // What to do if there is no first name?
We’ve got good news for you!
{{/if}} // End the #if statement

This will produce two versions of your email, personalized and formatted correctly:

Version 1: We've got good news for you, Heather!
Version 1


Version 2: We've got good news for you!
Version 2

Provide Engaging and Relevant Calls-to-Action

But what about a scenario that’s a little more complex? 

For example, nearing the end of a quarter is a great time to send email to generate interest and drive leads from Marketing to Sales for cross selling opportunities. A great way to ensure that handoff is smooth and seamless is to include the contact information for the recipient to reach out if they’re enticed by your call to action.

This is easy to do if the recipient already has an account owner with a phone number. But if that’s not the case, you’d like to provide more generic contact information. 

By having different content in each case, you can provide the most specific and relevant information to those who have it, while having a great back-up for those who don’t.

Here’s how you can solve this with #if:

Have questions about your account?

{{#if Recipient.Owner.Phone}} // We’ll check if the owner’s phone number is populated
Contact {{Recipient.Owner.Name}} at {{Recipient.Owner.Phone}}. // We’ll include the name and phone number if there is a phone number.
{{else}} // And if there isn’t a phone number?
Contact us at // We’ll provide a generic email address so recipients can still reach out
{{/if}} // end the if statement

Version 1: Connect with Us: Have questions about your account? Contact heather P Salesforce at 770-555-1234
Version 1


Version 2: Connect with Us: Have questions about your account? Contact us at
Version 2

What I love about this approach is that it provides contact information for all of the email’s recipients, including highly specific information when available, but still provides a call to action when it’s not available.

Get Started with HML Today

While the examples here are spaced out for clarity, be sure to preview emails as you’re getting familiar with HML to catch things like line breaks. Also, if you do have a default mail merge value set for a field, it will always use that default if the field is empty.

Make sure an empty or awkward personalization doesn’t happen to you! Upgrade your Pardot account to HML today and give it a try in your email!

Webinar: September 19 at 1pm ET / 10am PT. How to Align Marketing, Sales and Service with Account-Based Marketing. Vicki Brown, Research Director, Demand Marketing at SiriusDecisions. Register now.

Read Next

How Cure Cancer Finds, Stewards and Retains Donors with Salesforce Pardot

26 thoughts on “Introducing Handlebars Merge Language for Pardot: Ensure Perfect Personalization Every Time

  • Are any other operators available in this upgrade? For instance, I’d like to check if the number in a field is (x), display content (a) – more than x, display content b. In C# I would use something like

    #if {“$Total_Savings == x”}
    Content A
    Content B

    Also, how about elseif statements?

    • Hi Andy – For this release, #if is the only operator we implemented, and it’s only checking for the presence of data and not in comparison statements. If you’d like more features, I’d like to hear about them!

  • Does this work with Dynamic Content? I just tried it and it didn’t seem to work, though I may have done something wrong? The HML tags came through as text.

    Here’s my HML:

    1.877.448.7273 x. 2

    • Hi Dave – yes, it does work inside of dynamic content, however you do have to be using HML for that piece of dynamic content. So your example would be:
      {{#if Recipient.Owner.Phone}}
      1.877.448.7273 x. 2
      Hope that helps!

  • This is a great addition to the already flexible personalization options in Pardot. 🙂
    Hope this will work with all fields? Can it be used with content from custom fields or content brought in through custom objects? Are there any limitations to be aware of? Thanks

    • Hi Jens – Thank you for your feedback! This #if statement will work with all fields available in HML, and that includes custom prospect and account fields. Custom objects fields are not available yet. I hope you give it a try!

  • Hi,

    It looks great! Can it also be used to alter the html depending on different fields? For example images in the email, depending on sex.

    Another question is whether it slows down email loading process and by how much.

    I would be greatfull for you answer!

    • Hey Jack, regarding your speed question: It should not slow down loading of the e-mail on the recipients end. All the crunching happens before the mail is created, once it’s decided what fields or text to use the mail is created and then sent. No processing needed once it is sent out. At least thats how I understand it 😉

  • Hi Jack – Thanks for taking the time to comment! This #if statement does not support comparisons at this time. The example that you mentioned could be implemented using dynamic content, though. Also, we performed extensive testing to ensure that the performance of the new merge language matched the existing one. Hope you’ll check it out!

  • Can you add multiple {{#if}} statements? For example, using your example, would this work:

    {{#if Recipient.Owner.Email}} 
    {{#if Recipient.Owner.FirstName}}
    Contact {{Recipient.Owner.FirstName}} at {{Recipient.Owner.Email}}.
    Contact us at

    • Yes! You can nest #ifs, but you will need a closing tag for each if. Give it a try using the prospect preview in the email editor!

    • Hi Julie – HML in Pardot can be used for those who are still on Salesforce Classic, however some of the features that are built on HML (like Snippets, released in Winter ’20) do require Lightning.

  • Are there any rules or situations that could be used to eliminate the frequency of instances whereby the last name is in the first name field in Salesforce which then looks odd when embedded into the body copy of the email.

    • Hi Gregory – unfortunately, that’s not something that HML can help with. I would start by research tips and tricks on data integrity in Salesforce to help you get your data and data entry in a good place.

  • Hi Heather, I am using variable tags & after enabling HML most of the variable tags are not available. Please educate me on this.


  • How do you turn on HML? Initial instructions directed to follow up the upgrade banner but this doesn’t show up anymore.

    • Hi Kirsten – Is it possible that somebody else in your org has enabled it already? The only way to enable is through the banner, so if you’re not seeing the banner, there’s a problem. Please reach out to support!

  • I was curious if this can create more advanced “If statements”

    For example, in crafting an email to current customer base. Certain companies I need to add an additional line.

    Is something along the lines of
    IF Company = (list of companies) // Thank you for being a supplier
    If Company not equal = Contact us to learn discounts of being a supplier.

    • Hi Mark – HML only supports evaluating whether data is or isn’t present in a field. If you need more complex evaluations, you will still need to use dynamic content.

  • Given the link {{View_Online}} in one of my email template, however it’s taking the user to website’s home page and not showing the email in browser as it’s supposed to.

  • I am trying to combine HML with dynamic content but the dynamic content part doesn’t display. Am I using the syntax incorrectly?
    Here is my if/else statement:
    {{#if Recipient.Salutation}}
    {{{dynamic_content_457}}} {{Recipient.LastName}},
    {{else}} Guten Tag,

    • Hi Flora – your syntax is correct. We looked into this, though, and currently dynamic content isn’t working inside #if statements. We will be implementing a fix that will be out in the next several weeks.

Comments are closed.

Ready to see how marketing automation can help you grow at record speeds?
Request a personalized demo today!
Need help?No problem. Chat with our sales experts or call us at 1-800-667-6389.