Files
FixIt/layouts/_partials/init/global.html
T
Cell 3e8bdfd8f9 ♻️ Refactor: global/site/page scope state management (#610)
*  Perf: adjust global/site scope state management

*  Perf: adjust page scope state management
2025-07-03 12:48:32 +08:00

18 lines
873 B
HTML

{{- /* Set site home relative permalink */ -}}
{{- $homeRelPermalink := .Site.Home.RelPermalink -}}
{{- $homeRelPermalink = strings.TrimSuffix "archives/" $homeRelPermalink -}}
{{- $homeRelPermalink = strings.TrimSuffix "offline/" $homeRelPermalink -}}
{{- .Site.Store.Set "homeRelPermalink" $homeRelPermalink -}}
{{- /* Set pages of main sections */ -}}
{{- $pages := where .Site.RegularPages "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 -}}