mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Fix regression when config for OutputFormat.BaseName is an empty string
Fixes #11000
This commit is contained in:
@@ -32,6 +32,11 @@ type OutputFormatConfig struct {
|
||||
Format
|
||||
}
|
||||
|
||||
var defaultOutputFormat = Format{
|
||||
BaseName: "index",
|
||||
Rel: "alternate",
|
||||
}
|
||||
|
||||
func DecodeConfig(mediaTypes media.Types, in any) (*config.ConfigNamespace[map[string]OutputFormatConfig, Formats], error) {
|
||||
buildConfig := func(in any) (Formats, any, error) {
|
||||
f := make(Formats, len(DefaultFormats))
|
||||
@@ -59,20 +64,12 @@ func DecodeConfig(mediaTypes media.Types, in any) (*config.ConfigNamespace[map[s
|
||||
continue
|
||||
}
|
||||
|
||||
var newOutFormat Format
|
||||
newOutFormat := defaultOutputFormat
|
||||
newOutFormat.Name = k
|
||||
if err := decode(mediaTypes, v, &newOutFormat); err != nil {
|
||||
return f, nil, err
|
||||
}
|
||||
|
||||
// We need values for these
|
||||
if newOutFormat.BaseName == "" {
|
||||
newOutFormat.BaseName = "index"
|
||||
}
|
||||
if newOutFormat.Rel == "" {
|
||||
newOutFormat.Rel = "alternate"
|
||||
}
|
||||
|
||||
f = append(f, newOutFormat)
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user