diff options
-rw-r--r-- | config/allconfig/allconfig_integration_test.go | 18 | ||||
-rw-r--r-- | config/allconfig/alldecoders.go | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/config/allconfig/allconfig_integration_test.go b/config/allconfig/allconfig_integration_test.go index debdff650..1b677884f 100644 --- a/config/allconfig/allconfig_integration_test.go +++ b/config/allconfig/allconfig_integration_test.go @@ -160,3 +160,21 @@ title: "p3" b.AssertFileExists("public/page/1/index.html", false) b.AssertFileContent("public/page/2/index.html", "pagination-default") } + + +func TestMapUglyURLs(t *testing.T) { + files := ` +-- hugo.toml -- +[uglyurls] + posts = true +` + + b := hugolib.Test(t, files) + + c := b.H.Configs.Base + + mapUglyURLs, isMap := c.UglyURLs.(map[string]bool) + + b.Assert(isMap, qt.Equals, true) + b.Assert(mapUglyURLs["posts"], qt.Equals, true) +} diff --git a/config/allconfig/alldecoders.go b/config/allconfig/alldecoders.go index 45cdd0de6..60e571999 100644 --- a/config/allconfig/alldecoders.go +++ b/config/allconfig/alldecoders.go @@ -419,6 +419,8 @@ var allDecoderSetups = map[string]decodeWeight{ p.c.UglyURLs = vv case string: p.c.UglyURLs = vv == "true" + case maps.Params: + p.c.UglyURLs = cast.ToStringMapBool(maps.CleanConfigStringMap(vv)) default: p.c.UglyURLs = cast.ToStringMapBool(v) } |