FeedOtter Logo Standard

Tutorial: Create Your First Pardot Handlebars Email Template With Conditions in 3 Steps

Bottom Swoop SVG
Written by
Andy Theimer
Published on
August 27, 2019

I've been testing the Pardot Handlebars Merge Field feature this week and wanted to publish my exact test steps. If you are just getting started with Pardot or curious how to use this new feature I hope this tutorial will help you understand the basics.  Keep a watch out for an expanded tutorial walking you through the full process of creating an automated personalized content newsletter using FeedOtter for Pardot and the new Pardot handlebars (HML) feature.

How to Create a Pardot Handlebars Email Template with Conditions in 3 Steps

Step 1: Create Four Prospect Custom Fields

The first step in creating a Pardot Handlebars email template is to create Prospect custom fields. For this example, I used four of my favorite barnyard animals:

  • chicken_content
  • dog_content
  • fish_content
  • horse_content

All of these fields are type CHECKBOX with one value 'TRUE' and no default value. This is important because the handlebars conditions only evaluate empty OR set. The actual value doesn't matter and cannot be compared against at this time.

Create a pardot custom field

Step 2: Edit a Non-Important Prospect and Set Any Two of the New Custom Fields to TRUE

This second step is pretty self-explanatory. As shown in the image below, edit a non-important prospect and set any two of the new custom fields to TRUE.

Adjust Pardot custom fields

Step 3: Create a New Email Template

For the third and last step, create a new email template and paste in the following code:

{{Recipient.FirstName}},

Here is the content you asked for and nothing else:

{{#if Recipient.fish_content}} Fish Content{{/if}}
{{#if Recipient.dog_content}}Dog Content{{/if}}
{{#if Recipient.horse_content}}Horse Content{{/if}}



Regards,
{{Sender.Name}}
{{Sender.Title}}
{{Sender.Phone}}

You are receiving this email because you signed up to receive our monthly newsletter at http://www.example.com
Unsubscribe from email communications

{{{Organization.Address}}}

PRESTO! Now click the preview tab and select the contact whose fields you set to TRUE in step #2.  You will see that your email only shows Dog and Chicken content, not all four!

Demonstrate how Pardot's HML conditions work.

It's Not Perfect Yet

While this Pardot Handlebars advancement is a major step forward and super-exciting there are a couple of improvements I immediately have asked for such as:

1. The ability to chain {{#if}} {{#elseif}} statements. 

During testing, I wanted to create several sections of content shown only to users with matching custom field values. Because there is no way to do an ELSEIF and chain several statements together it is possible to send an email where no content is shown. An ELSEIF would allow me to create a default content area where I could display general content to those who did not match other conditions.

2. The ability to condition based on list name e.g. {{#if recipient.List.my_list_name }}

For my immediate use case, I wanted to change which content was shown based on preferences set on an email preference center page BUT preference centers only allow me to opt users into and out of lists. To get around this I created a number of Automation Rules to set and unset custom field values when a user enters or leaves a list.  It was doable but a bit tedious.

3. Actual comparison

I suspect this was left out to keep things simple but adding the ability to say {{#if Recipient.dog_content = "1"}} would be nice. As it is now the IF statements only compare if the field is set IE any value will equate to TRUE and thus the content being shown. It works, you just have to set up your fields carefully with this in mind.

Important Pardot Handlebars Links:

List of all Pardot handlebars merge codes

Pardot explanation of how to use conditionals with the new handlebars tokens

Recent Articles

WordPress RSS Feeds for Categories and Tags

WordPress makes an RSS feed for just about anything on your website. WordPress RSS feeds allow you to streamline the creation and automation of content email campaigns. Here, we'll show you how to find many different WordPress RSS feeds for your website. WordPress RSS Feeds for Categories One Category Feed Here's what the WordPress RSS […]

Read More
Quick & Easy Steps: Emailing Your Podcast Episodes with FeedOtter

Podcasting has been trending BIG TIME in 2020 and is a great, creative way to show your content to your clients. But what happens when you create an awesome podcast episode but no one knows it exists? That's where email marketing comes in. Emailing your podcast episode is a great way to bring your content […]

Read More
How To Remove "This Post First Appeared" From Your Blog's RSS Feed in WordPress

“How can I get rid of the ‘This post first appeared on’ sentence on my blog’s RSS feed?”  That’s a popular question that FeedOtter receives often from marketers. The sentence ‘This post first appeared on’ seems innocuous enough, but can actually be problematic. In an age where marketers are repurposing content and updating old posts […]

Read More

FeedOtter Can Help You Automate Blog and RSS Email

Promote your content and increase revenue from website traffic.
REQUEST A DEMO  
closearrow-circle-o-downbars