Allow empty params.mainSections

Updates #10953
This commit is contained in:
Bjørn Erik Pedersen
2023-05-18 15:50:48 +02:00
parent 95818e27dc
commit 7c647bcaeb
4 changed files with 35 additions and 1 deletions

View File

@@ -367,7 +367,7 @@ type ConfigCompiled struct {
func (c *ConfigCompiled) SetMainSectionsIfNotSet(sections []string) {
c.mu.Lock()
defer c.mu.Unlock()
if len(c.MainSections) > 0 {
if c.MainSections != nil {
return
}
c.MainSections = sections

View File

@@ -177,6 +177,9 @@ var allDecoderSetups = map[string]decodeWeight{
// Before Hugo 0.112.0 this was configured via site Params.
if mainSections, found := p.c.Params["mainsections"]; found {
p.c.MainSections = types.ToStringSlicePreserveString(mainSections)
if p.c.MainSections == nil {
p.c.MainSections = []string{}
}
}
return nil