Files
FixIt/layouts/_partials/init/global.html
T
Cell cc2ef7bf70 Feat: add enableTranslationMerge parameter for merging missing translations from other languages (#626)
- Add enableTranslationMerge parameter to control translation merging
- Default to false for better performance, especially for single-language sites
- Update comments to reflect the new default behavior
- Implement conditional translation merging in global.html"

- Add enableTranslationMerge parameter to control translation merging
- Default to false for better performance, especially for single-language sites
- Update comments to reflect the new default behavior
- Implement conditional translation merging in global.html"

> [!NOTE]
> This won't create new pages, if you need empty placeholder pages, you might need [shortcode-missing-translation](https://github.com/hugo-fixit/shortcode-missing-translation).
2025-08-19 12:27:14 +08:00

21 lines
818 B
HTML

{{- $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 -}}