Salutation Formatting For Nameless Subscribers

It’s a common use case: You want to personalize someone’s email by using their first name. You may try to use a liquid snippet like this:

Hey {{ subscriber.first_name | default: "" }},

But there’s a problem. If the first name isn’t set, you end up with this wonky salutation with an awkward space:

Hey ,

How to Fix This:

There’s a bit of liquid syntax that isn’t well documented, if you add a hyphen to your brackets, Liquid will strip the newlines around the tag:

Hey {{- subscriber.first_name | default: "" -}},

This also works with logic tags which would look like this:

 {%-  -%}

Want more? 

Check out some other Drip Quick Tips. If you get your subscriber’s first & last name as a single text field,  here’s a workflow that splits first and last names.