Defining conditionals
Conditionals allow you to show different content to different recipients based on properties of the recipient. For example, a loyalty program might show different content to gold members, silver members, and everyone else.
Conditionals defined in the Dynamic Content menu are reusable. Define them once, then use them in any email.
Sometimes you only need a conditional as a one-off. In that case, use an inline conditional. Inline conditionals can also be saved as templates, so you can reuse one as a starting point in another email.
| Type | Where it is defined | When to use it |
|---|---|---|
| Reusable conditional | Under Dynamic Content > Conditionals | When the same logic will be used across multiple emails or components |
| Inline conditional | Directly within the email editor | When the conditional is only needed for one email |
How conditional definitions work
Section titled “How conditional definitions work”Both reusable and inline conditionals consist of branches and syntax.
Branches
Section titled “Branches”Add a branch for each version of the content that you want to create. Give every branch a unique, descriptive label.
Syntax
Section titled “Syntax”Enter the syntax that your ESP uses to begin each branch, followed by the closing syntax. EmailShepherd adds this syntax around the corresponding branch content in the exported email.
For example, a Liquid conditional might use:
{% if membership == "gold" %}Gold members branch content
{% elsif membership == "silver" %}Silver members branch content
{% else %}Everyone else branch content
{% endif %}Dynamic Content Profiles
Section titled “Dynamic Content Profiles”If your workspace has Dynamic Content Profiles, you can define different syntax for each profile. This lets the same conditional export correctly to ESPs that use different template languages or syntax.
Each profile uses the default syntax unless you provide an override for that profile.
Create a reusable conditional
Section titled “Create a reusable conditional”Reusable conditionals are available throughout the workspace and can be updated centrally.
- Navigate to
Dynamic Content>Conditionals>Add conditional. - Enter a label, such as
Membership tiers. This is the name that will appear in the email editor. - Add the branches and enter a label and branch key for each one. The branch key is the unique identifier of the branch within the conditional.
For example:
| Branch label | Branch key |
|---|---|
| Gold members | gold_membership |
| Silver members | silver_membership |
| Everyone else | else |

- Enter the default syntax for each branch and the closing syntax.

- If you use Dynamic Content Profiles, enter any profile-specific syntax.
- If the conditional will be used in a subject or preheader, select
Can be used in subject and preheader. - Save the conditional.
Inline conditionals are defined while building an email. See Using conditionals in an email for the complete editor workflow.