]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Fix robots.txt using the built-in template regression
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 20 Feb 2024 09:02:42 +0000 (10:02 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 20 Feb 2024 10:17:44 +0000 (11:17 +0100)
Fixes #12071

hugolib/robotstxt_test.go
output/layouts/layout.go

index 2035c235ff649309a4626ace100c318e5468ffc3..c901ce6629b9b5e91a050050dee29f18e86bc5f3 100644 (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: *")
+}
index c05841ae33341ae2a8545eaf8cc3f18c2688bc0d..b903e09eaed4150ecd218eb11bc2a734852b4c0a 100644 (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")