{{ $scratch := newScratch }} {{ range where .this.Site.Pages ".Params.type" "!=" "outcome" }} {{if in (index .Params $.field) $.name }} {{ $scratch.Add "pages" (slice .) }} {{ end }} {{ if and (eq .Params.type "team") (in .Params.members $.name) }} {{ range .Params.sessions }} {{ $session := index (where (where $.this.Site.Pages ".Params.title" .) ".Params.type" "!=" "outcome") 0 }} {{ $scratch.Add "pages" (slice $session) }} {{ end }} {{ end }} {{ end }} {{ $all_sessions := $scratch.Get "pages" }} {{ range $all_sessions }}