Having trouble figuring out how to sort my returned JSON data. I’m trying to sort the data by the $element.modifier
values. But everything I’ve tried in inserting sort
has returned errors. Where should I be doing this?
(I tried putting {{ range sort . $element.modifier }}
after the initial range
but that didn’t work either.)
JSON data
{
"props": {
"NAME": {
"value": "16px",
"desc": "",
"css": "padding",
"modifier": "primary",
"function": "",
"color": "",
"group": "",
"element": "content",
"breakpoint": "",
"state": "",
"environment": "",
"hex": ""
},
...
}
}
Shortcode template:
{{ $pattern := .Get "pattern" }}
{{ $data := index .Site.Data.design_tokens $pattern }}
{{ range $index, $element := $data.props }}
Lines with {{ $element.modifier }} and more...
{{{ end }}