Range sort by frontmatter?

I’m trying to create a template view called “series” that uses a series taxonomy and leverages a custom frontmatter “seriesPart” to sort the articles. The idea is to keep weight as a default for ordering child pages in the default view, but when you view an article series it orders the pages via “seriesPart.”

This does not work:

 {{ range sort .Pages .Params.seriesPart "asc"}}
  ...
{{end}}

This, interestingly, also does not work:

 {{ range sort .Pages .Params.Weight "asc"}}
  ...
{{end}}

But this does work:

 {{ range sort .Pages "Weight" "asc"}}
  ...
{{end}}}

  • Is there an easy way to range sort via custom page params?
  • Why does “Weight” work but .Params.Weight not?

There is a ByParam method on the page colleciton.

2 Likes

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