I have a project with novel/characters manyToMany relationship.
I assigned ids to each novel, and then added a .Params.novel to each character with a map of novels as such:
---
title: Who Ever
type: character
novel:
- a-novel-about-this
- a-novel-about-that
---
Now, on a character page I can call the novels he/she appears in using:
{{ range where .Site.Pages.ByTitle ".Params.id" "in" .Params.novel }}
On my novel page though, in order to list their characters I have to use a range + .Scratch hack:
{{ range where .Site.Pages.ByTitle "Type" "character" }}
{{ if in .Params.novel $.Params.id }}
{{ $.Scratch.Add "characters" (slice . )}}
{{ end }}
{{ end }}
{{ range .Scratch.Get "characters" }}
I wondered if there was a more convenient way using where and if not, if it would be too complicated to add has as a new where operator so something like this could be used instead:
{{ range where .Site.Pages.ByTitle ".Params.novel" "has" .Params.id }}