aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-02-20 10:02:42 +0100
committerBjørn Erik Pedersen <[email protected]>2024-02-20 11:17:44 +0100
commita118cb4138bc903566ade49a7789d91657898a21 (patch)
treeb56c9415c42650e1e322acbf0eeb18c8c68fab6f
parente8cc785a589bb18c9336880d662a659f29bb57f3 (diff)
downloadhugo-a118cb4138bc903566ade49a7789d91657898a21.tar.gz
hugo-a118cb4138bc903566ade49a7789d91657898a21.zip
Fix robots.txt using the built-in template regression
Fixes #12071
-rw-r--r--hugolib/robotstxt_test.go13
-rw-r--r--output/layouts/layout.go2
2 files changed, 14 insertions, 1 deletions
diff --git a/hugolib/robotstxt_test.go b/hugolib/robotstxt_test.go
index 2035c235f..c901ce662 100644
--- a/hugolib/robotstxt_test.go
+++ b/hugolib/robotstxt_test.go
@@ -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: *")
+}
diff --git a/output/layouts/layout.go b/output/layouts/layout.go
index c05841ae3..b903e09ea 100644
--- a/output/layouts/layout.go
+++ b/output/layouts/layout.go
@@ -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")