mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
1 KiB
1 KiB
title | description | date | categories | menu | keywords | signature | workson | hugoversion | relatedfuncs | aliases | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
merge | `merge` deep merges two maps and returns the resulting map. | 2019-08-08 |
|
|
|
|
0.56.0 |
|
Merge creates a copy of the final MAP
and merges any preceding MAP
into it in reverse order.
Key handling is case-insensitive.
An example merging two maps.
{{ $default_params := dict "color" "blue" "width" "50%" "height" "25%" "icon" "star" }}
{{ $user_params := dict "color" "red" "icon" "mail" "extra" (dict "duration" 2) }}
{{ $params := merge $default_params $user_params }}
Resulting $params:
"color": "red"
"extra":
"duration": 2
"height": "25%"
"icon": "mail"
"width": "50%"
{{% note %}} Regardless of depth, merging only applies to maps. For slices, use [append]({{< ref "functions/append" >}}) {{% /note %}}