Mailfois
Email platform cheat sheets / HubSpot Marketing Hub
HubSpot Marketing Hub

HubSpot Marketing Hub email coding cheat sheet

The tags and rules you need to code an email or a module for HubSpot Marketing Hub: the unsubscribe link, personalisation with a fallback, the view-in-browser and address tags, editable regions and how to get your HTML in. Checked against HubSpot Marketing Hub's own documentation on 27 October 2026.

Unsubscribe
<a href="{{ unsubscribe_link }}">Manage preferences or unsubscribe</a> (required); {{ unsubscribe_link_all }} unsubscribes from every type
First name
{{ contact.firstname }} (HubL)
With a fallback
{{ contact.firstname|default("there", true) }}
View in browser
{% if content.create_page %}<a href="{{ view_as_page_url }}">View as web page</a>{% endif %}
Preferences
{{ unsubscribe_link }}
Postal address
{{ site_settings.company_name }}, {{ site_settings.company_street_address_1 }}, {{ site_settings.company_city }}, {{ site_settings.company_state }}

The HubSpot Marketing Hub unsubscribe link

Put this in the footer of every marketing email you code for HubSpot Marketing Hub:

<a href="{{ unsubscribe_link }}">Manage preferences or unsubscribe</a> (required); {{ unsubscribe_link_all }} unsubscribes from every type
  • Required to send: unsubscribe_link plus site_settings company_name, street_address_1, city and state.

The law in most countries also wants the unsubscribe to be easy to find and free to use: see the email rules by country.

Personalisation in HubSpot Marketing Hub: first name with a fallback

HubSpot Marketing Hub uses HubL. A first name on its own:

{{ contact.firstname }}

With a fallback, so an empty field never shows a blank or a raw tag:

{{ contact.firstname|default("there", true) }}

Showing something only to some people (an if / else):

{% if contact.firstname %}Hi {{ contact.firstname }}{% else %}Hi there{% endif %}
  • View in browser: {% if content.create_page %}<a href="{{ view_as_page_url }}">View as web page</a>{% endif %}
  • Preferences: {{ unsubscribe_link }}
  • Postal address: {{ site_settings.company_name }}, {{ site_settings.company_street_address_1 }}, {{ site_settings.company_city }}, {{ site_settings.company_state }}

Making a coded template editable in HubSpot Marketing Hub

A coded HTML + HubL template (annotation templateType: email). Content people edit per email is declared with module tags, such as content_attribute for the body or default email modules.

{% content_attribute "email_body" %}<p>Hi {{ contact.firstname }},</p>{% end_content_attribute %}
{% module "cta" path="@hubspot/email_cta" %}

Getting your HTML into HubSpot Marketing Hub

Create an HTML + HubL file in the design manager with the templateType: email annotation; it then appears only when choosing a template for a new email.

Limits worth knowing

  • Rules in one <style id="hs-inline-css"> are inlined; only one such tag per coded template.
  • Media queries cannot be inlined and must go in a separate <style>.
  • Use the email versions of default modules (e.g. @hubspot/email_cta), not the web ones.

What HubSpot Marketing Hub calls things

Every platform has its own words for the same ideas. HubSpot Marketing Hub's, in plain English:

The ideaHubSpot Marketing Hub calls itWorth knowing
One-off sendRegular emailA marketing email you write once and send or schedule to a chosen segment.
Automated journeyWorkflowAn automation enrolling records on trigger criteria, then running branching, timed actions. Not the same as a Sequence, which is a one-to-one sales tool.
Trigger / entryEnrollment triggerThe criteria that automatically enrol a record into a workflow.
Static groupStatic segmentA frozen group captured when you saved it; members are added or removed by hand. Renamed from static list, URLs and older screens still say list.
Dynamic groupActive segmentA self-updating group; records join and leave as they match the filters. Previously an active list, the two names mean the same thing.
Customer recordContactThe record for one person in the CRM: properties, activities and associations.
Custom fieldCustom propertyA field you create on an object to store data HubSpot doesn’t include by default.
Behavioural eventCustom behavioral eventA named action you define and send to HubSpot, such as a video watched. Enterprise only. HubSpot’s own tracked interactions are just “events”, different thing.
Reusable blockModuleA reusable content component; global modules update everywhere at once. A Snippet is a sales tool for one-to-one emails, not an email block.
TemplateEmail templateA saved layout deciding the structure and editable areas of new marketing emails. A sales template is a different object, saved copy for one-to-one emails.
Personalisation languageHubLHubSpot’s templating language for logic, loops and dynamic content.
Fallback valueDefault valueText shown when a personalization token has no value, set when inserting the token.
A/B testA/B testA split of one email into two versions sent to halves of the audience. Adaptive testing is a separate, higher-tier feature supporting more variations.
SuppressionSuppression listA segment used to stop contacts enrolling in a workflow; emails use excluded segments. Only blocks workflow enrolment, not an account-wide do-not-email list.
Frequency cappingEmail frequency safeguardA setting limiting how many marketing emails one contact receives in a period. Marketing Hub Enterprise only, lower tiers have no equivalent.
TransactionalTransactional emailReceipts and account notices ignoring subscription status, with no unsubscribe footer. Needs the paid Transactional Email add-on, you can’t just flag a marketing email.
Preference centreSubscription preferences pageThe hosted page where contacts tick which subscription types they want.
Send-time optimisationSend time optimizationSends at each contact’s best time, calculated from ninety days of opens and clicks. Per-contact optimisation is Enterprise; lower tiers get one suggested send time.
ReportingDashboardA single screen combining several reports.
Imported data tableHubDBA spreadsheet-like table of rows and columns you can query and display on pages. Not part of the CRM, HubDB rows are not contacts and cannot be emailed.
API-triggered sendSingle-send APIAn API call sending a saved transactional email to one recipient. The workflow Webhook action pushes data out, it does not trigger a send in.
Draft vs liveDraft / Published (workflows: ON / OFF)Content stays draft until published; workflows only act once switched ON.

What we couldn't confirm

We only list what HubSpot Marketing Hub's documentation says. These points weren't clear from it, so test them in your account:

  • Whether dnd_area (drag-and-drop areas) can be used in coded email templates; the docs only describe it for pages.
  • No separate "manage preferences" variable: unsubscribe_link itself opens the preferences page.
Do it in Mailfois. Ask Mailfois, your email marketing assistant, writes modules and whole templates for HubSpot Marketing Hub with these tags, fallbacks and editable regions already in place. Studio adds the unsubscribe and privacy links before you copy the code, and Brand Guard flags merge tags left without a fallback. How Ask Mailfois works

Questions

What is the unsubscribe tag in HubSpot Marketing Hub?

{{ unsubscribe_link }} (required); {{ unsubscribe_link_all }} unsubscribes from every type. Required to send: unsubscribe_link plus site_settings company_name, street_address_1, city and state.

How do I add a first name with a fallback in HubSpot Marketing Hub?

HubSpot Marketing Hub uses HubL. A first name is {{ contact.firstname }}, and with a fallback: {{ contact.firstname|default("there", true) }}

How do I add a view-in-browser link in HubSpot Marketing Hub?

Use {% if content.create_page %}{{ view_as_page_url }}{% endif %}.

How do I get a custom HTML email into HubSpot Marketing Hub?

Create an HTML + HubL file in the design manager with the templateType: email annotation; it then appears only when choosing a template for a new email.

Sources

Checked by Mailfois against HubSpot Marketing Hub's documentation on 27 October 2026. Platforms rename things often: spotted something out of date? Email [email protected].

Other platforms

Mailchimp · Klaviyo · Salesforce Marketing Cloud Engagement · Braze · Adobe Marketo Engage · Bloomreach Engagement · Brevo · Constant Contact · Campaign Monitor · Dotdigital · Iterable · Resend

Code for HubSpot Marketing Hub without looking up the tags.

Start with Ask Mailfois