When doing a range on a group/array of items, I like to use the key in the range loop for creating links. The key values may be like
{ "abc": { "somedata": True, "sort_order": 2 }, "def": { "some_data": True, "sort_order": 1 }, "ghi": { "somedata": True, "sort_order": 3 } }
Which should give me the keys of “abc”, “def”,“ghi” when I do
range $key, $item := .Params.thearray
This works fine until I change the range to be
range $key, $item := .Params.thearray | .Params.thearray "sort_order"
.
The keys from $keys are now 1,2,3 instead. Can I either preserve the keys, or store them and still be able to use them?