Data are converted in json for readability, use go maps in hugo html templates
{
"toto": 1,
"fields":
[
"import fields title",
"import fields enable",
{
"label": "Layout",
"name": "design",
"options":
[
{"label": "Hero Area","value":"hero-area"},
{"label": "Page title","value":"page-title"},
{"label": "Section","value":"section"}
],
"required": true, "widget": "select"
},
{
"extend": {"label": "Parallax enable","name": "parallax"}
},
"import fields enable"
]
}
Second, the combining map
{
"fields":
[
{"import": "fields title"},
{"import": "fields enable"},
{
"options":
[
{"label": "Hero parallax","value":"hero-parallax"},
],
}
]
}
So with : {{ partial "map-combine.html" (dict "one" $map1 "two" $map2) }}
Gives :
Replace on slice index and map key recursively If data type isn't the same, we keep old value
{
"toto": 1,
"fields":
[
"import fields title",
"import fields enable",
{
"label": "Layout",
"name": "design",
"options":
[
{"label": "Hero parallax","value":"hero-parallax"},
{"label": "Page title","value":"page-title"},
{"label": "Section","value":"section"}
],
"required": true, "widget": "select"
},
{
"extend": {"label": "Parallax enable","name": "parallax"}
},
"import": "fields enable"
]
}