aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-03-07 08:55:19 +0100
committerBjørn Erik Pedersen <[email protected]>2024-03-07 09:50:50 +0100
commit4d5e173cf82b74c53e3279d75b0243e86ee8bcfc (patch)
treece6814ac1d541248b474d9587489cacaaa6e9b01
parent4271b6be0fe18ffdd8dd1bf74e996d339b2fb209 (diff)
downloadhugo-4d5e173cf82b74c53e3279d75b0243e86ee8bcfc.tar.gz
hugo-4d5e173cf82b74c53e3279d75b0243e86ee8bcfc.zip
Fix global resource isn't published when using an uncommon code construct
Fixes #12190
-rw-r--r--tpl/resources/resources_integration_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/tpl/resources/resources_integration_test.go b/tpl/resources/resources_integration_test.go
index d72b13507..38ff79055 100644
--- a/tpl/resources/resources_integration_test.go
+++ b/tpl/resources/resources_integration_test.go
@@ -143,3 +143,31 @@ ByType: /401K%20Prospectus.txt|http://example.com/401K%20Prospectus.txt|
`)
}
+
+func TestGlobalResourcesNotPublishedRegressionIssue12190(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+disableKinds = ['page','rss','section','sitemap','taxonomy','term']
+-- assets/a.txt --
+I am a.txt
+-- assets/b.txt --
+I am b.txt
+-- layouts/index.html --
+{{ with resources.ByType "text" }}
+ {{ with .Get "a.txt" }}
+ {{ .Publish }}
+ {{ end }}
+ {{ with .GetMatch "*b*" }}
+ {{ .Publish }}
+ {{ end }}
+{{ end }}
+`
+
+ b := hugolib.Test(t, files)
+
+ b.AssertFileExists("public/index.html", true)
+ b.AssertFileExists("public/a.txt", true) // failing test
+ b.AssertFileExists("public/b.txt", true) // failing test
+}