mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Make hugo.toml the new config.toml
Both will of course work, but hugo.toml will win if both are set. We should have done this a long time ago, of course, but the reason I'm picking this up now is that my VS Code setup by default picks up some JSON config schema from some random other software which also names its config files config.toml. Fixes #8979
This commit is contained in:
@@ -782,3 +782,55 @@ defaultMarkdownHandler = 'blackfriday'
|
||||
b.Assert(err.Error(), qt.Contains, "Configured defaultMarkdownHandler \"blackfriday\" not found. Did you mean to use goldmark? Blackfriday was removed in Hugo v0.100.0.")
|
||||
|
||||
}
|
||||
|
||||
// Issue 8979
|
||||
func TestHugoConfig(t *testing.T) {
|
||||
filesTemplate := `
|
||||
-- hugo.toml --
|
||||
theme = "mytheme"
|
||||
[params]
|
||||
rootparam = "rootvalue"
|
||||
-- config/_default/hugo.toml --
|
||||
[params]
|
||||
rootconfigparam = "rootconfigvalue"
|
||||
-- themes/mytheme/config/_default/hugo.toml --
|
||||
[params]
|
||||
themeconfigdirparam = "themeconfigdirvalue"
|
||||
-- themes/mytheme/hugo.toml --
|
||||
[params]
|
||||
themeparam = "themevalue"
|
||||
-- layouts/index.html --
|
||||
rootparam: {{ site.Params.rootparam }}
|
||||
rootconfigparam: {{ site.Params.rootconfigparam }}
|
||||
themeparam: {{ site.Params.themeparam }}
|
||||
themeconfigdirparam: {{ site.Params.themeconfigdirparam }}
|
||||
|
||||
|
||||
`
|
||||
|
||||
for _, configName := range []string{"hugo.toml", "config.toml"} {
|
||||
configName := configName
|
||||
t.Run(configName, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := strings.ReplaceAll(filesTemplate, "hugo.toml", configName)
|
||||
|
||||
b, err := NewIntegrationTestBuilder(
|
||||
IntegrationTestConfig{
|
||||
T: t,
|
||||
TxtarString: files,
|
||||
},
|
||||
).BuildE()
|
||||
|
||||
b.Assert(err, qt.IsNil)
|
||||
b.AssertFileContent("public/index.html",
|
||||
"rootparam: rootvalue",
|
||||
"rootconfigparam: rootconfigvalue",
|
||||
"themeparam: themevalue",
|
||||
"themeconfigdirparam: themeconfigdirvalue",
|
||||
)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user