mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
824 B
824 B
title | linkTitle | description | categories | keywords | menu | function | relatedFunctions | aliases | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
collections.KeyVals | keyVals | Returns a KeyVals struct. |
|
|
|
|
The primary application for this function is the definition of the namedSlices
parameter in the options map passed to the .Related
method on the Page
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]