Please see below example:
Front Matter:
authors:
- Goeth Smalinsky
- Jordan Nevelin
In a partial:
{{ $authorsPages := where .Site.RegularPages "Params.authors" "Geoth Smalinksky" }}
The above returns false.
I believe correctly so, as “Params.authors” doesn’t equal a string, it’s an array of values, so, how then would I test this correctly?
I’ve tried various solutions, and am now simply ranging through $authorsPages and testing the Params with an if statement.
A la:
{{ $authorsPages := where .Site.RegularPages "Params.authors" "!=" nil }}
{{ range $authorsPages }}
{{ if eq (index .Params.authors 0) "Jordan Nevelin" }}
// Do stuff
{{ end }}
{{ end }}
Which works fine, but it seems this could be much cleaner if I could write a better where statement.
Thank you for the assistance.