<reponame>blakyaks/website
{{- $.Scratch.Add "index" slice -}}
{{- range $index, $page := where site.Pages "Section" "policies" -}}
  {{- if .Params.policyType }}
    {{- $type := .Params.policyType -}}
    {{- $policy := index (intersect (split $type ",") site.Params.policies) 0 -}}
    {{- $.Scratch.Add "index" (dict 
      "title" $page.Title
      "body" .Params.description
      "link" $page.RelPermalink 
      "policy" $policy
      "category" .Params.category 
      "version" .Params.version
      "subject" .Params.subject
      "filters" (printf "%s::%s::%s::%s" $policy .Params.category .Params.version .Params.subject)
    ) -}}
  {{- end }}
{{- end -}}
{{- jsonify (uniq ($.Scratch.Get "index")) -}}