Fix robots.txt using the built-in template regression

Fixes #12071
This commit is contained in:
Bjørn Erik Pedersen 2024-02-20 10:02:42 +01:00
parent e8cc785a58
commit a118cb4138
2 changed files with 14 additions and 1 deletions

View file

@ -39,3 +39,16 @@ func TestRobotsTXTOutput(t *testing.T) {
b.AssertFileContent("public/robots.txt", "User-agent: Googlebot")
}
func TestRobotsTXTDefaultTemplate(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
baseURL = "http://auth/bub/"
enableRobotsTXT = true
`
b := Test(t, files)
b.AssertFileContent("public/robots.txt", "User-agent: *")
}

View file

@ -222,7 +222,7 @@ func resolvePageTemplate(d LayoutDescriptor) []string {
}
switch d.Kind {
case "robotsTXT":
case "robotstxt":
layouts = append(layouts, "_internal/_default/robots.txt")
case "sitemap":
layouts = append(layouts, "_internal/_default/sitemap.xml")