How can i sort by weight from the data folder?

also, in general, how can i sort from the data folder?

i understand weights from frontmatter, but how does it work for different sortings in the data folder?

I looked in the Docs, no solutions for you.

@bep nice, if this could work:

{{ $file := .Params.datafile}}
{{ $data := getJSON $file }}
{{ range ($data.items.ByParam "Weight" ) }}

What are you trying to accomplish? Basically, you access your data and sort it.

For example, you might sort the range statement in this section, as per usual:

1 Like

I found it!

{{ $file := .Params.datafile}}
{{ $data := getJSON $file }}
{{ range sort $data.items "weight"}}
2 Likes

what if i am using yaml? is there a different getJSON function?

also, i find it a bit odd that someone else gets to tag this “solved”, while it hasn’t yet solved my problem

You can substitute yaml for what I linked.