This returns pages in descending order. What I want to do is introduce a second param from the front matter that will take precedence if it is present. What I tried to do was this:
Assuming that where RenewedDate is present in the front matter it will be used instead of the date but this doesn’t seem to do what I want, instead the pages remain in the same order as the original block.
TOML is always a better choice when you have custom date parameters.
With TOML, date values are first-class citizens. TOML has a date data type while JSON and YAML do not. If you quote a TOML date, it is a string. If you do not quote a TOML date value, it is a time.Time value, enabling precise comparisons.
Note that the four predefined front matter dates are cast to time.Time values regardless of front matter format.
You can’t use functions within the sort function’s first argument. Instead, you can build a slice of maps, where each map has two keys: sortDate and page.