{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $sections := .Site.Params.mainSections }}
{{ $.Scratch.Set "authors" (slice ) }}
{{ $.Scratch.Set "noAuthors" 0 }}
{{ range where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ with .Params.authors }}
{{ if eq ( printf "%T" . ) "[]string" }}
{{ if ( not ( in ($.Scratch.Get "authors") . ) ) }}
{{ $.Scratch.Add "authors" . }}
{{ end }}
{{ else if ( printf "%T" . ) "[]string" }}
{{ range . }}
{{ if ( not ( in ($.Scratch.Get "authors") . ) ) }}
{{ $.Scratch.Add "authors" . }}
{{ end }}
{{ end }}
{{ end }}
{{ else }}
{{ $.Scratch.Add "noAuthors" 1 }}
{{ end }}
{{ end }}
{{ $.Scratch.Set "cats" (slice ) }}
{{ $.Scratch.Set "nocat" 0 }}
{{ range where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ with .Params.categories }}
{{ if eq ( printf "%T" . ) "[]string" }}
{{ if ( not ( in ($.Scratch.Get "cats") . ) ) }}
{{ $.Scratch.Add "cats" . }}
{{ end }}
{{ end }}
{{ else }}
{{ $.Scratch.Add "nocat" 1 }}
{{ end }}
{{ end }}
{{ $tags := $.Site.Taxonomies.tags.ByCount }}
{{ $.Scratch.Set "untagged" 0 }}
{{ range $pages }}
{{ with .Params.tags }}{{ else }}{{ $.Scratch.Add "untagged" 1 }}{{ end }}
{{ end }}