When the 'allThemes' configuration setting is read, it will panic if
there are no themes. This was a regression introduced in Hugo 0.42.
Also updated a unit test to check for this.
Fixes #4851
if err != nil {
return nil, err
}
+
+ if len(themeConfigs) == 0 {
+ return nil, nil
+ }
+
v1.Set("allThemes", themeConfigs)
var configFilenames []string
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) {