[solved] Sorting by page params

This is really a “I don’t know how to properly format the query” question, so consider it a 101 level ask:

I have front matter in my /writers/ documents that have an alphabetize_by variable, which spells out the name to be sorted. I want to range over “Type” “writers” and return the list sorted by alphabetize_by, but I’m having trouble getting that right.

So, first: can you sort via front matter params? If so, what’s the pattern I’m looking for?

I figured this out myself. I’m doing this in the context of the writers list page, so all I needed was this:

{{ range sort .Pages ".Params.alphabetize_by" }}

Easy!

1 Like