Files
hugo/docs/content/en/functions/collections/Dictionary.md
T
Bjørn Erik Pedersen 30a20122b7 Merge commit '8f3c066d23f431fb2c53d97ea489e4c28b42bd82'
# Conflicts:
#	docs/data/docs.yaml
2026-02-14 12:14:33 +01:00

854 B

title, description, categories, keywords, params, aliases
title description categories keywords params aliases
collections.Dictionary Returns a map created from the given key-value pairs.
functions_and_methods
aliases returnType signatures
dict
map[string]any
collections.Dictionary [VALUE...]
/functions/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
}

To create an empty map:

{{ $m := dict }}

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"
    }
  }
}