Skip to content

Commit

Permalink
Fix robots.txt using the built-in template regression
Browse files Browse the repository at this point in the history
Fixes #12071
  • Loading branch information
bep committed Feb 20, 2024
1 parent e8cc785 commit a118cb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions hugolib/robotstxt_test.go
Expand Up @@ -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: *")
}
2 changes: 1 addition & 1 deletion output/layouts/layout.go
Expand Up @@ -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")
Expand Down

0 comments on commit a118cb4

Please sign in to comment.