collections.KeyVals
Returns a KeyVals struct by pairing a given key and values.
Syntax
collections.KeyVals KEY VALUE...
Returns
types.KeyValues
Alias
keyVals
The primary application for this function is the definition of the namedSlices value in the options map passed to the Related method on the Pages object.
See related content.
{{ $kv := keyVals "foo" "a" "b" "c" }}The resulting data structure is:
{
"Key": "foo",
"Values": [
"a",
"b",
"c"
]
}To extract the key and values:
{{ $kv.Key }} → foo
{{ $kv.Values }} → [a b c]Last updated:
February 14, 2026
:
Merge commit '8f3c066d23f431fb2c53d97ea489e4c28b42bd82' (3e2f98235)
Improve this page