From f17e67b4b5e80d45834ab67dcca1fbb5b209ade5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 11 Nov 2019 14:37:37 +0100 Subject: [PATCH] tpl/collections: Allow dict to create nested structures Fixes #6497 --- content/en/functions/dict.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/content/en/functions/dict.md b/content/en/functions/dict.md index 007cc30c5..76fdde284 100644 --- a/content/en/functions/dict.md +++ b/content/en/functions/dict.md @@ -21,6 +21,12 @@ aliases: [] `dict` is especially useful for passing more than one value to a partial template. +Note that the `key` can be either a `string` or a `string slice`. The latter is useful to create a deply nested structure, e.g.: + +```go-text-template +{{ $m := dict (slice "a" "b" "c") "value" }} +``` + ## Example: Using `dict` to pass multiple values to a `partial`