hugolib: Fix shortcode namespace issue

Fixes #5863
This commit is contained in:
Bjørn Erik Pedersen 2019-04-15 15:17:46 +02:00
parent 7881b0965f
commit 56550d1e44
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
4 changed files with 57 additions and 6 deletions

View file

@ -1126,3 +1126,32 @@ CONTENT:{{ .Content }}
}
}
// https://github.com/gohugoio/hugo/issues/5863
func TestShortcodeNamespaced(t *testing.T) {
t.Parallel()
assert := require.New(t)
builder := newTestSitesBuilder(t).WithSimpleConfigFile()
builder.WithContent("page.md", `---
title: "Hugo Rocks!"
---
# doc
hello: {{< hello >}}
test/hello: {{< test/hello >}}
`).WithTemplatesAdded(
"layouts/shortcodes/hello.html", `hello`,
"layouts/shortcodes/test/hello.html", `test/hello`).CreateSites().Build(BuildCfg{})
s := builder.H.Sites[0]
assert.Equal(1, len(s.RegularPages()))
builder.AssertFileContent("public/page/index.html",
"hello: hello",
"test/hello: test/hello",
)
}