aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/multilingual.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-01-30 17:51:18 +0100
committerBjørn Erik Pedersen <[email protected]>2018-01-30 18:53:07 +0100
commitae742cb1bdf35b81aa0ede5453da6b0c4a4fccf2 (patch)
treef2922d4343f9819e7ff4220ebc333b467c8f0d4b /hugolib/multilingual.go
parentfeeed073c3320b09fb38168ce272ac88b987f1d2 (diff)
downloadhugo-ae742cb1bdf35b81aa0ede5453da6b0c4a4fccf2.tar.gz
hugo-ae742cb1bdf35b81aa0ede5453da6b0c4a4fccf2.zip
Fix language params handling
This fixes some issues with language params handling by separating params from configuration values per language. This means that you can now do this: ```toml [languages] [languages.en] languageName = "English" weight = 1 title = "My Cool Site" [languages.en.params] myParam = "Hi!" ``` This is not a breaking change, but the above is a less suprising way of configuring custom params. It also fixes some hard-to-debug corner-cases in multilingual sites. Fixes #4356 Fixes #4352
Diffstat (limited to 'hugolib/multilingual.go')
-rw-r--r--hugolib/multilingual.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/hugolib/multilingual.go b/hugolib/multilingual.go
index 589df66e0..101de7ace 100644
--- a/hugolib/multilingual.go
+++ b/hugolib/multilingual.go
@@ -111,10 +111,20 @@ func toSortedLanguages(cfg config.Provider, l map[string]interface{}) (helpers.L
language.LanguageName = cast.ToString(v)
case "weight":
language.Weight = cast.ToInt(v)
+ case "params":
+ m := cast.ToStringMap(v)
+ // Needed for case insensitive fetching of params values
+ helpers.ToLowerMap(m)
+ for k, vv := range m {
+ language.SetParam(k, vv)
+ }
}
// Put all into the Params map
language.SetParam(loki, v)
+
+ // Also set it in the configuration map (for baseURL etc.)
+ language.Set(loki, v)
}
langs[i] = language