From b7dc93ca11b3aa7fb20e302c29c65af17067526d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 12 Jun 2023 14:30:43 +0200 Subject: [PATCH] config: Remove unexpected _merge keys introduced in author and social maps Fixes #11083 --- config/allconfig/alldecoders.go | 4 ++-- hugolib/config_test.go | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/allconfig/alldecoders.go b/config/allconfig/alldecoders.go index b45bd1e11..1c8573f3d 100644 --- a/config/allconfig/alldecoders.go +++ b/config/allconfig/alldecoders.go @@ -336,14 +336,14 @@ var allDecoderSetups = map[string]decodeWeight{ "author": { key: "author", decode: func(d decodeWeight, p decodeConfig) error { - p.c.Author = p.p.GetStringMap(d.key) + p.c.Author = maps.CleanConfigStringMap(p.p.GetStringMap(d.key)) return nil }, }, "social": { key: "social", decode: func(d decodeWeight, p decodeConfig) error { - p.c.Social = p.p.GetStringMapString(d.key) + p.c.Social = maps.CleanConfigStringMapString(p.p.GetStringMapString(d.key)) return nil }, }, diff --git a/hugolib/config_test.go b/hugolib/config_test.go index 3b137d8d6..7f278f00a 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -695,6 +695,10 @@ func TestHugoConfig(t *testing.T) { filesTemplate := ` -- hugo.toml -- theme = "mytheme" +[social] +twitter = "bepsays" +[author] +name = "bep" [params] rootparam = "rootvalue" -- config/_default/hugo.toml -- @@ -711,6 +715,8 @@ rootparam: {{ site.Params.rootparam }} rootconfigparam: {{ site.Params.rootconfigparam }} themeparam: {{ site.Params.themeparam }} themeconfigdirparam: {{ site.Params.themeconfigdirparam }} +social: {{ site.Social }} +author: {{ site.Author }} ` @@ -735,6 +741,8 @@ themeconfigdirparam: {{ site.Params.themeconfigdirparam }} "rootconfigparam: rootconfigvalue", "themeparam: themevalue", "themeconfigdirparam: themeconfigdirvalue", + "social: map[twitter:bepsays]", + "author: map[name:bep]", ) })