6 · Templates
Template language reference
EJS tags, the articles array, the wrapper and merge tags.
Templates are HTML with EJS tags. EJS fills in field values when the newsletter is composed; merge tags are filled in per recipient when it is sent. This page is a compact reference for template authors.
EJS tags
| Tag | Use |
|---|---|
<%= value %> | Output a value, HTML-escaped. Use for text, URLs and colours. |
<%- html %> | Output raw HTML. Use for Rich text fields and article intro texts. |
<% code %> | Run JavaScript: conditions, loops, helper variables. |
Every template field is available as a variable named after its Variable name.
The articles array
A field of type Articles is an array of objects, in the order the editor arranged them:
| Property | Content |
|---|---|
id | Article ID |
title | Title (can be changed per newsletter in the composer) |
category | Category label (can be changed per newsletter) |
publishUp | Publication date |
author | Author name |
url | Absolute link to the article (see Options → Articles) |
intro | Intro text as HTML, with absolute image and link addresses (can be changed per newsletter) |
image | Intro or full-text image URL, if any |
readMore | true when the article has more text than the intro |
Example
A minimal block with a bespoke heading field headline, a colour palette accent and an articles field articles:
<% const color = (accent && accent.length) ? accent[0] : '#14213D'; %>
<table width="100%"><tr><td bgcolor="<%= color %>" height="5"></td></tr></table>
<h1><%= headline %></h1>
<% articles.forEach(function (a) { %>
<h2><a href="/<%= a.url %>"><%= a.title %></a></h2>
<% if (a.image) { %><img src="/<%= a.image %>" alt="<%= a.title %>" width="552"><% } %>
<%- a.intro %>
<% }); %>
<p><a href="/{{ unsubscribe_url }}">Unsubscribe</a></p>
Wrapper
The optional Wrapper is an outer layout shared by the template, for example a branded frame with header and footer. It receives the rendered template as content (also available as body) together with all field values:
<table width="600"><tr><td><%- content %></td></tr></table>
Merge tags
Merge tags are replaced for every recipient at send time. They work in subjects, templates, freeform content and the footer.
| Tag | Value |
|---|---|
{{ firstname }}, {{ lastname }}, {{ name }}, {{ email }} | Subscriber details |
{{ field.<name> }} | A subscriber field, for example {{ field.company }} |
{{ unsubscribe_url }} | Personal unsubscribe link |
{{ manage_url }} | Personal link to the manage-subscription page |
{{ webview_url }} | Link to the web version of the newsletter |
{{ subject }}, {{ date }}, {{ year }} | Newsletter subject, send date and year |
{{ site_name }}, {{ site_url }} | Your site |
{{ list_names }} | Names of the lists through which the person receives the newsletter |
{{ privacy_url }} | Privacy policy page (Options → Subscription) |
{{ sender_address }} | Your organisation's postal address (Options → Sender) |
Write a fallback after a pipe for subscribers without a value: Hello {{ firstname | there }}.
{{ unsubscribe_url }}, the footer from Options → Sending (with unsubscribe and preference links) is appended automatically. Every message also carries a one-click List-Unsubscribe header.Atjaunināts 16 novembris 2026