mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 06:30:33 +03:00
hugolib: Fix bundle resource publishing when multiple output formats
The faulty logic published the bundled resources for the "first output" format. This worked most of the time, but since the output formats list is sorted, any output format only used for some of the pages (e.g. CSS) would not work properly. Fixes #5858
This commit is contained in:
parent
b799b12f4a
commit
49d0a82641
5 changed files with 83 additions and 41 deletions
|
@ -903,6 +903,7 @@ func TestShortcodeParentResourcesOnRebuild(t *testing.T) {
|
|||
b.WithTemplatesAdded(
|
||||
"index.html", `
|
||||
{{ $b := .Site.GetPage "b1" }}
|
||||
b1 Content: {{ $b.Content }}
|
||||
{{$p := $b.Resources.GetMatch "p1*" }}
|
||||
Content: {{ $p.Content }}
|
||||
{{ $article := .Site.GetPage "blog/article" }}
|
||||
|
@ -933,20 +934,23 @@ SHORTCODE: {{< c >}}
|
|||
|
||||
b.Build(BuildCfg{})
|
||||
|
||||
assert := func() {
|
||||
b.AssertFileContent("public/index.html",
|
||||
"Parent resource: logo.png: /b1/logo.png",
|
||||
assert := func(matchers ...string) {
|
||||
allMatchers := append(matchers, "Parent resource: logo.png: /b1/logo.png",
|
||||
"Article Content: <p>SHORTCODE: \n\n* Parent resource: logo-article.png: /blog/logo-article.png",
|
||||
)
|
||||
|
||||
b.AssertFileContent("public/index.html",
|
||||
allMatchers...,
|
||||
)
|
||||
}
|
||||
|
||||
assert()
|
||||
|
||||
b.EditFiles("b1/index.md", pageContent+" Edit.")
|
||||
b.EditFiles("content/b1/index.md", pageContent+" Edit.")
|
||||
|
||||
b.Build(BuildCfg{})
|
||||
|
||||
assert()
|
||||
assert("Edit.")
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue