Skip to content
Back to blog
email9/14/2026

Why Every Template Link Is a Role, Not a URL

A real defect in an earlier version of the template corpus — thousands of dead href="#" links that passed a shallow test — is why every link in the email app's templates is now a typed role instead of a raw URL.

emailtemplatesengineering

Most "how we build templates" posts are marketing. This one is closer to an incident report with a fix attached, and it's worth telling because the fix is a genuinely good idea that came from a genuinely real problem.

An earlier version of the email app's template corpus had roughly 1,920 links across its templates that pointed at href="#" — syntactically valid, technically non-empty, and going absolutely nowhere. They passed the quality gate that existed at the time, because that gate only checked that an href attribute was present and non-empty. # satisfies that check while doing nothing useful for an actual recipient, and — because the send pipeline only rewrites https:// links for click tracking — a # link was also untrackable on top of being dead. The gate was measuring "an href attribute exists," which was never actually the property worth having.

The fix changes what a link is, not just how it's validated. Every link in the current template system is typed as a LinkTarget, and that type is a closed set with exactly two shapes: a real url (an actual https:// address, used sparingly, for the rare case a template genuinely knows its destination) or a merge field, which names the role a link plays — a call-to-action, an unsubscribe link, a "view in browser" link — and lets the actual destination get filled in at send time, per recipient, per campaign.

That's the real insight: a template can't know a customer's specific destination URL when it's written, so pretending otherwise (by writing a real-looking href that's actually a placeholder) is how you end up with 1,920 dead links passing a test that thought it was checking something meaningful. Naming the link's role instead of faking a URL means there's no placeholder to forget to replace, because there's nothing pretending to be a real address in the first place.

It's a small, specific engineering story rather than a broad claim about template quality — but it's the kind of specific, verifiable fix that's more credible than any amount of "our templates are professionally built" marketing copy could be on its own.

Why Every Template Link Is a Role, Not a URL — Piskes