A merge tag only works correctly when there is data in the field it's associated with. To avoid nothing populating when a certain field contains no data, be sure to set a default merge tag.

Setting a Default Merge Tag

{{ example merge tag|default:"enter text" }}

Adding |default:"enter text" to your pre-existing merge tag allows you to set a default word to populate when the recipient doesn't have the relevant information for the merge tag value

Note: If no default is set and the recipient doesn't have the value, nothing will populate on the template.


Setting the default value for the first name merge tag to "there" will populate the word "there" within a template if the user has no first name data.

E.g. {{ user.first_name|default:"there" }} Hi, → Hi there,

Check out these related articles:

Did this answer your question?