I’m curious for the best way to loop over nested content when using Related Content indices.
For example, I have related content called reviews_books
that lists books in a book review. To access it from a review, I can:
{{ $reviewsbooks := where ( .Site.RegularPages.RelatedIndices . "reviews_books" ) "Type" "books" }}
And then I can list all the books a review mentions:
{{ range $reviewsbooks }}{{ .Params.name }}{{ end }}
That works great. But, I also want to access the index books_author
, which is only accessible from the context of a reviews_books
instance.
What I want, in pseudocode:
Range over $reviewsbooks
For this book, range over `books_author` and return as $authors
Bonus context: in many places I’m going to combine them so it will read Herman Melville's _Moby Dick_
, or Ann Patchett's _State of Wonder_, and _Commonwealth_
, or even: Ann Patchett's _State of Wonder_, and _Commonwealth_, and Herman Melville's _Moby Dick_
. I’ve solved this problem before in other templating languages, but I’m looking for the cleanest most Golang like way of expressing this problem.