aboutsummaryrefslogtreecommitdiffhomepage
path: root/config/allconfig
diff options
context:
space:
mode:
authorAkkuman <[email protected]>2024-10-12 15:48:19 +0800
committerBjørn Erik Pedersen <[email protected]>2024-10-14 10:03:44 +0200
commitea633dd809233d9f59b605bfe1955bcc1417c3fe (patch)
treec1303e70e259f9a2e661665c534b9d524f27c93a /config/allconfig
parent57151a5e911cd4a951925b231d67e62b19a54a47 (diff)
downloadhugo-ea633dd809233d9f59b605bfe1955bcc1417c3fe.tar.gz
hugo-ea633dd809233d9f59b605bfe1955bcc1417c3fe.zip
config: Fix uglyurls map parse
Fixes #12926
Diffstat (limited to 'config/allconfig')
-rw-r--r--config/allconfig/allconfig_integration_test.go18
-rw-r--r--config/allconfig/alldecoders.go2
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)
}