Quick Guide
An overview of the functionality and all of the modifiers
Templating engine built for workflows, document generation, and data transformations.
{{ response | from:'json' | key:'orders' | filter:'status','paid' | pluck:'total' | sum | decimal:2 }}Features
- Pipe syntax — chain 51 built-in modifiers to transform any value in a single expression
- Dependency resolution — variables can reference each other; sintax resolves them in the correct order automatically
- Cycle detection — circular variable references are caught at resolution time, not at runtime
- Nested data — maps, slices, structs, and pointers are all resolved and rendered recursively
- Conditionals —
{{ if x }} … {{ else }} … {{ endif }}blocks - Loops —
{{ for v in items }} … {{ endfor }}over slices and maps, with auto-bound index/key helpers - Typed errors — parse failures, missing variables, and circular dependencies are surfaced as distinct, branchable error categories
- Extensible — register your own modifiers alongside the built-ins
Template syntax
| Pattern | Example |
|---|---|
| Variable | {{ name }} |
| Modifier chain | {{ text | trim | upper }} |
| Modifier with args | {{ items | join:',' }} |
| Variable as argument | {{ text | trim-prefix:prefix_var }} |
| Fallback to literal | {{ value | default:'n/a' }} |
| Fallback to empty array | {{ items | default:[] }} |
| Fallback to empty object | {{ user | default:{} }} |
| If / else | {{ if active }}yes{{ else }}no{{ endif }} |
| Loop over a slice | {{ for x in items }}- {{ x }}\n{{ endfor }} |
| Loop with index | {{ for i, x in items }}{{ i }}:{{ x }} {{ endfor }} |
| Loop over a map | {{ for k, v in headers }}{{ k }}={{ v }} {{ endfor }} |
Modifier syntax: the name and the first argument are separated by :, additional arguments by ,.
String literals use single or double quotes; unquoted tokens resolve as variables, numbers, or booleans.
Block tags use endif and endfor to close.
Whitespace control
A leading or trailing - inside a tag eats whitespace on that side, the same way Jinja and Go templates do:
| Pattern | Effect |
|---|---|
{{- expr }} | strip trailing whitespace (including newlines) from the text before this tag |
{{ expr -}} | strip leading whitespace (including newlines) from the text after this tag |
{{- expr -}} | both at once |
Block control tags (if/else/endif/for/endfor) that sit alone on their own line are auto-trimmed —
the surrounding indentation and the line's newline are removed automatically, so you don't have to write - on
every block tag just to keep your output clean. Use the explicit {{- / -}} form when a tag shares a line
with text or you want extra whitespace eaten.
Loops
{{ for v in xs }} iterates over slices, arrays, and maps. Two binding forms are supported:
{{ for v in xs }} … {{ endfor }} # bind value
{{ for i, v in xs }} … {{ endfor }} # bind index/key + valueInside the loop body the following helpers are available — <v> is whatever name you bound the value to:
| Binding | Set on |
|---|---|
<v>_index | both slice and map iterations (0-based) |
<v>_first, <v>_last | both — booleans for the first/last iteration |
<v>_key | map iterations only, when no explicit key name was bound |
Map iteration order is sorted by key. Loops nest freely and parent variables remain visible inside the body.
{{ for item in cart }}{{ item.name }} × {{ item.qty }}{{ if item_last }}.{{ else }}, {{ endif }}{{ endfor }}Special variables
These names resolve to runtime-generated values without being declared.
| Name | Returns |
|---|---|
{{ uuid }} | UUID v4 string (alias for uuidv4) |
{{ uuidv1 }} | UUID v1 string (time + MAC) |
{{ now }} | timestamp — pipe into format |
{{ [] }} | empty array — useful with default |
{{ {} }} | empty object — useful with default |
Modifiers
Each modifier links to its own page with full inputs, parameters, and examples.
Text
Trim, case-shift, slugify, split, and reshape strings.
| Modifier | Description | Example |
|---|---|---|
concat | Concat appends one or more strings to the value. | {{ greeting | concat:'!' }} |
join | Join combines an array of strings into a single string with a separator. | {{ tags | join:',' }} |
lines | Lines splits a string or byte slice into an array of lines. | {{ note | lines }} |
lower | ToLower converts a string to lowercase. | {{ email | lower }} |
replace | Replace replaces all occurrences of a substring within the string value. | {{ greeting | replace:'world','everyone' }} |
replace_pattern | ReplacePattern replaces all regex matches within the string value. | {{ text | replace_pattern:'\s+',' ' }} |
reverse | Reverse reverses the characters in a string. | {{ name | reverse }} |
sexy | Sexy returns a bear ASCII art. | {{ anything | sexy }} |
shorten | Shorten truncates a string to the given maximum character length. | {{ description | shorten:30 }} |
slug | Slug converts a string to a URL-friendly slug. | {{ title | slug }} |
split | Split splits a string into an array using a separator. | {{ csv_line | split:',' }} |
title | Title converts a hyphen-separated slug into a title-cased string. | {{ slug | title }} |
title_model | ModelTitle formats an AI model identifier into a human-readable title. | {{ model_id | title_model }} |
trim | Trim removes leading and trailing whitespace, or the given character set. | {{ name | trim }} |
trim-prefix | TrimPrefix removes a leading prefix string or leading whitespace from the value. | {{ path | trim-prefix:'/' }} |
trim-suffix | TrimSuffix removes a trailing suffix string or trailing whitespace from the value. | {{ url | trim-suffix:'/' }} |
upper | ToUpper converts a string to uppercase. | {{ name | upper }} |
Collections
Sort, filter, find, and reshape arrays and maps.
| Modifier | Description | Example |
|---|---|---|
filter | Filter returns a subset of a slice where a nested field matches a value. | {{ items | filter:'status','active' }} |
find | Find returns the first element in a slice or map where a field equals the given value. | {{ users | find:'id',42 }} |
first | First returns the first character of a string or the first element of a slice. | {{ items | first }} |
flatten | Flatten flattens a slice of slices by one level. | {{ groups | pluck:'items' | flatten }} |
has | Has returns true if the slice or map contains the given value. | {{ tags | has:'featured' }} |
is | Is returns true if the value equals any of the given parameters. | {{ status | is:'active' }} |
key | Key extracts a value from a map or slice by key path or index. | {{ user | key:'name' }} |
last | Last returns the last character of a string or the last element of a slice. | {{ items | last }} |
map | Map converts a slice of maps into a map keyed by the given field's string value. | {{ users | map:'id' }} |
merge | Merge converts a slice of maps into a map keyed by the given field's string value. | {{ users | merge:'id' }} |
pluck | Pluck extracts a single field from each element of a slice of maps and returns a slice of values. | {{ users | pluck:'id' }} |
sort | Sort sorts a slice in ascending or descending order. | {{ names | sort }} |
sum | Sum returns the numeric sum of the elements of a slice. | {{ amounts | sum }} |
wrap | Wrap wraps the value in a map under the given key. | {{ name | wrap:'user' }} |
Boolean
Compare values for use inside if/else blocks and conditional expressions.
| Modifier | Description | Example |
|---|---|---|
eq | Eq returns true if the value equals the given parameter. | {{ status | eq:'active' }} |
gt | Gt returns true if the numeric value is greater than the threshold. | {{ items_in_cart | gt:0 }} |
gte | Gte returns true if the numeric value is greater than or equal to the threshold. | {{ qty | gte:1 }} |
not | Not inverts the truthiness of the value. | {{ is_active | not }} |
Convert
Move between Go values, JSON, YAML, and other serialized formats.
| Modifier | Description | Example |
|---|---|---|
from | From parses the string value as the given format and returns the parsed result. | {{ body | from:'json' }} |
json | JSON serializes the value to a JSON string. | {{ user | json }} |
markdown | Markdown converts an HTML string to Markdown. | {{ html_content | markdown }} |
yaml | YAML serializes or parses a value as YAML. | {{ config | yaml }} |
Utilities
Defaults, lengths, line numbers, and date formatting.
| Modifier | Description | Example |
|---|---|---|
decimal | Decimal formats a number with a fixed number of decimal places. | {{ amount | decimal:2 }} |
default | Default returns the fallback value if the input is nil or an empty string. | {{ name | default:'anonymous' }} |
format | Format formats a time. | {{ created_at | format:'YYYY-MM-DD' }} |
length | Length returns the number of characters in a string, bytes in a byte slice, or elements in a slice/array/map. | {{ name | length }} |
line-numbers | LineNumbers prepends each line of the string with its zero-based line number. | {{ note | line-numbers }} |
File System
Pull pieces out of file paths — directory, name, and extension.
| Modifier | Description | Example |
|---|---|---|
dirname | Dirname returns the directory portion of a file path. | {{ file_path | dirname }} |
ext | FilenameExt returns the file extension without the leading dot. | {{ file_path | ext }} |
ext-dot | FilenameExtDot returns the file extension including the leading dot. | {{ file_path | ext-dot }} |
ext-prepend | FilenamePrependExt inserts an additional extension before the existing file extension. | {{ file_path | ext-prepend:'min' }} |
ext-trim | FilenameTrimExt returns the file path without its extension. | {{ file_path | ext-trim }} |
filename | Filename returns the base file name from a path, including the extension. | {{ file_path | filename }} |
Money
Convert numbers between currency units like dollars and cents.
| Modifier | Description | Example |
|---|---|---|
currency | Currency converts a numeric value between currency units by applying a unit multiplier ratio. | {{ price | currency:1,100 }} |
How is this guide?