Template Variables

Template variables are a concept that have multiple names: "mail merges" might be one you're more familiar with if you have a marketing and email background. The concept is to add snippets in your email that are programmatically replaced when Buttondown sends out an email; this allows you to customize your content per-subscriber or to repeat certain key concepts in your email without having to change them over and over again.

Template variable library

subscriber.can_view_premium_contentWhether or not a subscriber is able to view premium content
{% if subscriber.can_view_premium_content %}Click here to check out the full version of the podcast!{% endif %}.
subscriber.metadataAccess to the metadata for a given subscriber
Hi there, {{ subscriber.metadata.first_name }}!
You're looking dapper today.
subscriber.emailAccess to the email address for a given subscriber
You signed up for this email via {{ subscriber.email }}.
subscriber.can_be_upsoldWhether or not a subscriber is able to be upsold to a paid subscription
{% if subscriber.can_be_upsold %}
Want to get even more content? Click [here]({{ subscriber.get_upgrade_url }})!
{% endif %}
subscriber.subscriber_typeAccess to the subscriber type (premium, regular, etc) for a given subscriber
{% if subscriber.subscriber_type == "premium" %}
Thanks for your patronage!
{% endif %}
subscriber.tagsAccess to the tag names of a given subscriber
{% if "python" in subscriber.tags %}
You know, I bet you're interested in Python!
{% elif "html" in subscriber.tags %}
You know, you strike me as a web developer.
{% else %}
I don't know what you're interested in!
{% endif %}
email.subjectThe subject of the email you're sending out
Today, we'll be discussing {{ email.subject }}.
unsubscribe_urlA personalized URL for the given subscriber to unsubscribe with
Not interested in this email?
No worries — [unsubscribe here]({{ unsubscribe_url }}).
subscribe_urlA generic URL for your subscription page
Did someone forward you this email?
If so, you can [subscribe here]({{ subscribe_url }}).
email_urlThe permalink of the email being sent out
You can also view this email [online]({{ email_url }}).
upgrade_urlA link to prompt existing free subscribers to upgrade. (Only relevant for paid newsletters.)
You can upgrade to a premium subscription [here]({{ upgrade_url }}).
premium_subscribe_urlA link to prompt existing free subscribers to upgrade. (Only relevant for paid newsletters.) This is the exact same thing as upgrade_url.
You can upgrade to a premium subscription [here]({{ premium_subscribe_url }}).
email.secondary_idThe issue number of the email being sent out
This is issue #{{ email.secondary_id }} of my newsletter!
email.publish_dateThe raw date time of the email being sent out
Sent on {{ email.publish_date }}.
subscribe_formAn embedded subscribe form for your newsletter, just like the one that appears at the bottom of your archives. Note that this only appears on the web/archive version of your email; it will not appear in the actual emails sent to subscribers.
Want more sweet insights like these?
{{ subscribe_form }}
mediumEither 'email' (for emails) or 'web' (for web views)
You're reading this via {{ medium }}.