diff --git a/hugolib/config.go b/hugolib/config.go index 87f97f3a5..122bd3f1e 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -285,6 +285,11 @@ func loadThemeConfig(d ConfigSourceDescriptor, v1 *viper.Viper) ([]string, error if err != nil { return nil, err } + + if len(themeConfigs) == 0 { + return nil, nil + } + v1.Set("allThemes", themeConfigs) var configFilenames []string diff --git a/hugolib/config_test.go b/hugolib/config_test.go index 2fa26d4f3..0fe692805 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -42,6 +42,8 @@ func TestLoadConfig(t *testing.T) { assert.Equal("side", cfg.GetString("paginatePath")) // default assert.Equal("layouts", cfg.GetString("layoutDir")) + // no themes + assert.False(cfg.IsSet("allThemes")) } func TestLoadMultiConfig(t *testing.T) {