Vetrix Docs

Merge-field reference

Every email template is a Go text/template (or html/template when body_html is non-empty). References take the form {{ .Namespace.Field }}. The list below enumerates every namespace Vetrix declares and every leaf the engine ships canonical sample values for (used by the preview page's synthetic fixture).

Auto-injected namespaces

These are available on every render without the slug having to declare them:

System

Path Sample Kind
System.CurrentYear 2026 int
System.ServerTimeRFC3339 2026-04-21T14:00:00Z time
System.EmailMessageID <uuid@vetrix.example> string

Notification-category namespaces

Issue

Path Sample Kind
Issue.Number 42 int
Issue.Title Fix pagination on issue list string
Issue.State open string
Issue.URL https://vetrix.example/acme/repo/issues/42 string
Issue.Excerpt first 4 KiB of issue body or comment string

Repo

Path Sample Kind
Repo.Owner acme string
Repo.Name repo string
Repo.Path acme/repo string
Repo.URL https://vetrix.example/acme/repo string

Actor

Path Sample Kind
Actor.Username alice string
Actor.DisplayName Alice Admin string

Recipient

Path Sample Kind
Recipient.Username bob string
Recipient.Email bob@example.com string
Recipient.DisplayName Bob Reader string

Comment (only issue.commented)

Path Sample Kind
Comment.Body Looks good to me. string
Comment.URL https://vetrix.example/acme/repo/issues/42#comment-7 string

Mention (only issue.mentioned)

Path Sample Kind
Mention.Context /cc @bob string

Transition (only issue.transitioned)

Path Sample Kind
Transition.From in_progress string
Transition.To review string

Slug-specific namespaces

ResetURL (only password_reset)

Path Sample Kind
ResetURL https://vetrix.example/reset?token=… string

Server (only smtp_test)

Path Sample Kind
Server.Host vetrix.example string
Server.Version 1.4.0 string

Sealed funcmap

Every template can call the following funcs. Calls to anything outside this list fail at save time with kind: "unknown_function".

  • upper / lower — case conversion.
  • default <fallback> <value> — returns fallback when value is empty or zero.
  • coalesce <vals...> — returns the first non-empty.
  • trunc <n> <s> — rune-aware truncate with ellipsis.
  • date <fmt> <time> — format a time via Format.
  • time_ago <time> — "3 minutes ago".
  • url_encode <s> — RFC 3986 path-segment encoding.
  • html_safe <s> — marks a string as pre-escaped HTML. Only available in body_html templates — a plaintext template that references html_safe fails at parse time.

Rendering rules

  • html/template is used when body_html is non-empty; otherwise text/template. HTML-safe contextual escaping is automatic.
  • missingkey=zero is set — an undefined map key returns the zero value rather than a render error. Use {{ if ... }} to guard optional sections.
  • The engine rejects references to undeclared namespaces at parse time (not render time) so the admin UI can surface the error inline.