Sorting a range based on a param contained within

I have a range of regular pages, how do I sort them based on a parameter common to all those pages?

psudo code:

{{ $filtered_set := (where site.RegularPages “Section” “=” “something”) }}
// $sorted_set = $filtered_set sorted in ascending order of $filtered_set.Params.foo.bar
{{ range $elem_index, $elem_val := $sorted_set }}
{{ $elem_val.Title}} //Displayed in the order sorted earlier
{{end}}

{{ range sort (where site.RegularPages "Section" "something") "Params.foo.bar" "asc" }}
  <h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
{{ end }}
2 Likes

Thanks. Worked flawlessly

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.