mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 07:12:05 -05:00
864 B
864 B
title | description | categories | keywords | action | aliases | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
collections.Dictionary | Returns a map composed of the given key-value pairs. |
|
|
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 slice
. 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"
}
}
}