Filtering from data templates

hello, i have a bunch of yaml files in my data folder, something like this:

(from 1.yaml)
title: ABC
what: solo
venue: 1 Pennsylvania Ave.
when: 2010-12-12
who: Frank Zappa

(from 2.yaml)
title: XYZ
what: group
venue: 13 Pennsylvania Ave.
when: 2016-11-23
who: Captain Beefheart

i have some 40-50 files like this.
now i want to display all “solo” examples, and sort them by ranging over the whole data folder, how to do so?

something like:

    {{ range (where .Site.Data "what" "eq" "solo") }}
	<li><p>{{ .title }}</p></li>

{{ end }}

isn’t outputting anything … help?

Here’s one way to do this:

{{ range .Site.Data }}
  {{ if eq .what "solo" }}
    {{ .title }}
  {{ end }}
{{ end }}

that works, thank you

could i also sort this somehow?

Sort by what?

sort by date
(in my examples i call it “when”)

i solved it by:

{{ range sort .Site.Data ".when" "desc" }}
  {{ if eq .what "solo" }}
    {{ .title }}
  {{ end }}
{{ end }}

easy peasy