mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Fix global resource isn't published when using an uncommon code construct
Fixes #12190
This commit is contained in:
parent
4271b6be0f
commit
4d5e173cf8
1 changed files with 28 additions and 0 deletions
|
@ -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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue