diff options
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/config.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/hugolib/config.go b/hugolib/config.go index 9f206bc77..b166e7729 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -54,7 +54,7 @@ func LoadConfigDefault(fs afero.Fs) (*viper.Viper, error) { // LoadConfig loads Hugo configuration into a new Viper and then adds // a set of defaults. -func LoadConfig(d ConfigSourceDescriptor) (*viper.Viper, []string, error) { +func LoadConfig(d ConfigSourceDescriptor, doWithConfig ...func(cfg config.Provider) error) (*viper.Viper, []string, error) { var configFiles []string fs := d.Fs @@ -108,6 +108,14 @@ func LoadConfig(d ConfigSourceDescriptor) (*viper.Viper, []string, error) { configFiles = append(configFiles, themeConfigFile) } + // We create languages based on the settings, so we need to make sure that + // all configuration is loaded/set before doing that. + for _, d := range doWithConfig { + if err := d(v); err != nil { + return v, configFiles, err + } + } + if err := loadLanguageSettings(v, nil); err != nil { return v, configFiles, err } |