Collections and maps

length
Length of a string (characters), array or map.
default
value when the input is undefined (only then; boolean=true also replaces falsy values). Not Go’s default.
default_if_empty
Go’s default: value when the input is undefined, none, 0, “”, or an empty array or map. false counts as set.
get
The map entry key, else default, else an error.
get_path
Walks path (keys and integer indices); none when a step is missing.
first
The first element, or none.
last
The last element, or none.
nth
The element at index n, or none.
keys
The keys of a map.
values
The values of a map.
pairs
[key, value] pairs of a map.
sort_keys
The map with its keys sorted; Go ranges maps in key order, Tera literals keep insertion order.
from_pairs
A map from [key, value] pairs (the inverse of pairs), for keys a map literal cannot compute: [[k, v]] | from_pairs. Keys are stringified, a later pair wins, keys sorted.
append
The array with value appended.
concat
The array followed by the elements of with.
merge
Deep merge of two maps; with wins; keys sorted.
join
Joins with sep.
delimit
Joins with sep, and last before the final element.
reverse
Reversed array or string.
unique
Removes duplicates, keeping the first.
sort
Tera’s sort (by value, or by attribute path); not locale-aware. Use sort_by for Go’s sort.
group_by
Tera’s grouping by attribute path into a map.
sort_by
Sorts by attribute (a path such as params.weight; "" or value: the elements): collation of the render’s lang, dates as instants, stable.
complement
Elements not in without (pages compared by id).
union
Elements of either array, first occurrence kept (pages by id).
intersect
Elements present in both (pages by id).
symdiff
Elements present in exactly one (pages by id).
range
Integers from start (default 0) to end (exclusive) by step_by; Go’s seq N is range(start=1, end=N+1).
querify
A URL query string from params, keys sorted.

    Type to search titles, headings and text.