Collections and maps
length- Length of a string (characters), array or map.
defaultvaluewhen the input is undefined (only then;boolean=truealso replaces falsy values). Not Go’sdefault.default_if_empty- Go’s
default:valuewhen the input is undefined, none, 0, “”, or an empty array or map.falsecounts as set. get- The map entry
key, elsedefault, 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 ofpairs), for keys a map literal cannot compute:[[k, v]] | from_pairs. Keys are stringified, a later pair wins, keys sorted. append- The array with
valueappended. concat- The array followed by the elements of
with. merge- Deep merge of two maps;
withwins; keys sorted. join- Joins with
sep. delimit- Joins with
sep, andlastbefore the final element. reverse- Reversed array or string.
unique- Removes duplicates, keeping the first.
sort- Tera’s sort (by value, or by
attributepath); not locale-aware. Usesort_byfor Go’ssort. group_by- Tera’s grouping by
attributepath into a map. sort_by- Sorts by
attribute(a path such asparams.weight;""orvalue: the elements): collation of the render’slang, 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) toend(exclusive) bystep_by; Go’sseq Nisrange(start=1, end=N+1). querify- A URL query string from
params, keys sorted.