I’m using GroupByParam to group pages based on a front matter string. It works quite well for a single piece of data, but I’m confused how to handle more than one entry.
If I want to aggregate movie directors, it only works when there is one director. For a film with two or more directors I can’t figure out how to handle grouping. Using an array doesn’t seem to work.
Is there an easy / obvious way to deal with this that I’m missing? Sample code including below.
Working front matter
director: Martin Scorsese
Problem front matter
director: Danny Boyle, Loveleen Tandan
Or
director: Danny Boyle
director: Loveleen Tandan
Or
director:
- Danny Boyle
- Loveleen Tandan
Template
{{ range .Site.Pages.GroupByParam .Params.key }}
<p>{{ .Key }}</p>
{{ range .Pages }}
<p>{{ .Title }}</p>
{{ end }}
{{ end }}