{{- $pages := .Site.RegularPages }}

{{- /* Merge missing translations from other languages */ -}}
{{- if .Site.Params.enableTranslationMerge -}}
  {{- range .Site.Home.Translations -}}
    {{- $pages = $pages | lang.Merge .Site.RegularPages -}}
  {{- end -}}
{{- end -}}

{{- /* Set pages of main sections */ -}}
{{- $pages = where $pages "Section" "in" .Site.MainSections -}}
{{- $pages = $pages | union (where .Site.RegularPages "Type" "in" .Site.MainSections) -}}
{{- .Site.Store.Set "mainSectionPages" $pages -}}

{{- /* Select the scope named `public_repo` to generate personal access token */ -}}
{{- $header := dict "Authorization" "" -}}
{{- with (getenv "HUGO_PARAMS_GHTOKEN") -}}
  {{- $header = dict "Authorization" (printf "token %v" .)  -}}
{{- end -}}
{{- hugo.Store.Set "githubTokenHeader" $header -}}
