mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
fix: config.js was not working on multilingual sites (#658)
This commit is contained in:
@@ -20,6 +20,7 @@ FixIt theme assets partial
|
||||
{{- $config = dict "version" (hugo.Store.Get "version") | merge $config -}}
|
||||
{{- $author := partial "function/get-author-map.html" .Params.author -}}
|
||||
{{- $uniqueFileId := "" -}}
|
||||
{{- $languagePrefix := .Site.LanguagePrefix -}}
|
||||
{{- with .File -}}
|
||||
{{- $uniqueFileId = .UniqueID -}}
|
||||
{{- end -}}
|
||||
@@ -328,7 +329,7 @@ FixIt theme assets partial
|
||||
{{- end -}}
|
||||
{{- $targetPath := "" -}}
|
||||
{{- if $uniqueFileId -}}
|
||||
{{- $targetPath = $uniqueFileId | printf "js/config/%s.js" -}}
|
||||
{{- $targetPath = printf "%s/js/config/%s.js" $languagePrefix $uniqueFileId -}}
|
||||
{{- end -}}
|
||||
{{- dict "Content" $configJS "Path" $targetPath "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
|
||||
@@ -336,7 +337,7 @@ FixIt theme assets partial
|
||||
{{- if .Store.Get "hasMathJax" -}}
|
||||
{{- $targetPath := "" -}}
|
||||
{{- if $uniqueFileId -}}
|
||||
{{- $targetPath = $uniqueFileId | printf "js/lib/mathjax/%s.min.js" -}}
|
||||
{{- $targetPath = printf "%s/js/lib/mathjax/%s.min.js" $languagePrefix $uniqueFileId -}}
|
||||
{{- end -}}
|
||||
{{- $options := dict "targetPath" $targetPath "minify" hugo.IsProduction -}}
|
||||
{{- if not hugo.IsProduction -}}
|
||||
@@ -373,14 +374,14 @@ FixIt theme assets partial
|
||||
|
||||
{{- with .Store.Get "styleArr" -}}
|
||||
{{- $content := delimit . " " -}}
|
||||
{{- $path := $uniqueFileId | printf "css/page/%s.scss" -}}
|
||||
{{- $path := printf "%s/css/page/%s.scss" $languagePrefix $uniqueFileId -}}
|
||||
{{- $options := printf "css/page/%s.min.css" $uniqueFileId | dict "targetPath" -}}
|
||||
{{- dict "Content" $content "Path" $path "ToCSS" $options | dict "Page" $ "Data" | partial "store/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Store.Get "scriptArr" -}}
|
||||
{{- $content := delimit . "\n" -}}
|
||||
{{- $targetPath := $uniqueFileId | printf "js/page/%s.js" -}}
|
||||
{{- $targetPath := printf "%s/js/page/%s.js" $languagePrefix $uniqueFileId -}}
|
||||
{{- dict "Content" $content "Path" $targetPath "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- hugo.Store.Set "version" "v0.4.0-alpha.3-20251124094436-9c98f214" -}}
|
||||
{{- hugo.Store.Set "version" "v0.4.0-alpha.3-20251124100610-99fd4fb7" -}}
|
||||
{{- .Store.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
|
||||
@@ -101,12 +101,13 @@
|
||||
|
||||
{{- /* Insert config */ -}}
|
||||
{{- $uniqueFileId := "" -}}
|
||||
{{- $languagePrefix := .Site.LanguagePrefix -}}
|
||||
{{- with .File -}}
|
||||
{{- $uniqueFileId = .UniqueID -}}
|
||||
{{- end -}}
|
||||
{{- $targetPath := "" -}}
|
||||
{{- if $uniqueFileId -}}
|
||||
{{- $targetPath = $uniqueFileId | printf "js/config/post-chat/%s.js" -}}
|
||||
{{- $targetPath = printf "%s/js/config/post-chat/%s.js" $languagePrefix $uniqueFileId -}}
|
||||
{{- end -}}
|
||||
{{- dict "Content" $configJS "Path" $targetPath "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user