collections.Dictionary
Returns a map created from the given key-value pairs.
- Syntax
- collections.Dictionary [VALUE...]
- Returns
- map[string]any
- Alias
- dict
Specify the key-value pairs as individual arguments:
{{ $m := dict "a" 1 "b" 2 }}The above produces this data structure:
{
"a": 1,
"b": 2
}Note that the key can be either a string or a []string. The latter is useful to create a deeply nested structure, e.g.:
{{ $m := dict (slice "a" "b" "c") "value" }}The above produces this data structure:
{
"a": {
"b": {
"c": "value"
}
}
}To create an empty map:
{{ $m := dict }}Last updated:
October 10, 2026
:
theme: Migrate aliases to a redirects data file (b732eba6c)
Improve this page