Link
A Link input is for standalone URLs in the Email Editor.
Works great for:
-
Button destinations
-
Image links
-
CTA URLs and other standalone destinations that should behave like a URL, not plain text
Use a Link input instead of Text String when the value should be validated as a URL or when you want to collect extra HTML attributes alongside the URL.
Validation is optional and can be enabled per input when needed:
-
Required can make the link mandatory before review/export
-
Must change from default can force the marketer to replace the starting destination
-
Regex can add an extra pattern rule for the URL value
URL rules
Link inputs also include URL-specific options:
-
Only allow https is enabled by default
-
Allow merge tags lets the field accept a merge tag such as
[destination_url]instead of a literal URL
If the current default value does not match these rules, the Template Editor shows the error and blocks saving until the default is fixed.
Link inputs accept AMPscript and Liquid expressions inside the URL, so a marketer can paste in personalized destinations like:
https://www.example.com/account?member=%%=v(@MemberID)=%%
without the field rejecting the value as invalid. This is mostly useful for Salesforce Marketing Cloud templates — see SFMC AMPscript links below for what happens at render time.
Custom link attributes
You can optionally define Custom Link Attributes on the input. Each attribute adds an extra field in the Email Editor so the marketer can set values such as:
-
data-*attributes for tracking -
aria-*attributes for accessibility -
other approved attributes you want to expose in a controlled way
Each custom attribute can also be marked as required. When a URL is present, Better Email blocks Review and export until every required attribute on that link has a non-empty value. The validation message is shown on the specific attribute field that needs attention.
The saved link value is an object with:
{
"url": "https://example.com",
"attributes": {
"data-campaign-id": "spring"
}
}
Using linkAttributes in Liquid
Use the linkAttributes Liquid filter when you want to render the configured custom attributes onto an anchor tag.
<a href="{{ cta.url }}" {{ cta | linkAttributes }}>Shop now</a>
<a href="https://example.com" data-campaign-id="spring">Shop now</a>
The filter only renders non-empty string attributes and safely escapes both attribute names and values before output.
Salesforce Marketing Cloud AMPscript links
When the active integration is Salesforce Marketing Cloud, Better Email looks at every anchor tag in the rendered HTML and rewrites any href containing AMPscript to:
%%=RedirectTo(TreatAsContent(...))=%%
This means a standard template like:
<a href="{{ cta.url }}" {{ cta | linkAttributes }}>Shop now</a>
keeps working even when the marketer has entered an AMPscript-personalized URL in the Link input. The rewrite happens on the final HTML, so it does not matter whether the URL came from a Link input, a rich text link, or a hand-written anchor in the template.
For non-SFMC integrations, the link is left exactly as the marketer entered it.
Explicit Liquid filters
The automatic rewrite covers the common case of an AMPscript URL inside an href. For everything else, three filters are available:
ampscript_link— wraps withRedirectTo(TreatAsContent(...)). Useful if you want the wrapping to be explicit in the template instead of relying on the auto-rewrite.ampscript_content— wraps withTreatAsContent(...)only. Use this for places likesrc, alt text, or anywhere you want personalization treated as content rather than markup.ampscript_escape— returns just the safely escaped AMPscript expression so you can wrap it yourself.
Example:
<a href="{{ cta.url | ampscript_link }}" {{ cta | linkAttributes }}>Shop now</a>
<img src="{{ hero.image.url | ampscript_content }}" alt="" />
The filters are no-ops for non-SFMC integrations, so the same template still works elsewhere.