mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
Fix bundle resource ordering regression
Introduced in Hugo 0.64.0 Fixes #6851
This commit is contained in:
@@ -1336,3 +1336,35 @@ bundle min min key: {{ $jsonMinMin.Key }}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TestPageBundlerHome(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := qt.New(t)
|
||||
|
||||
workDir, clean, err := htesting.CreateTempDir(hugofs.Os, "hugo-bundler-home")
|
||||
c.Assert(err, qt.IsNil)
|
||||
|
||||
cfg := viper.New()
|
||||
cfg.Set("workingDir", workDir)
|
||||
fs := hugofs.NewFrom(hugofs.Os, cfg)
|
||||
|
||||
os.MkdirAll(filepath.Join(workDir, "content"), 0777)
|
||||
|
||||
defer clean()
|
||||
|
||||
b := newTestSitesBuilder(t)
|
||||
b.Fs = fs
|
||||
|
||||
b.WithWorkingDir(workDir).WithViper(cfg)
|
||||
|
||||
b.WithContent("_index.md", "---\ntitle: Home\n---\n")
|
||||
b.WithSourceFile("content/data.json", "DATA")
|
||||
|
||||
b.WithTemplates("index.html", `Title: {{ .Title }}|First Resource: {{ index .Resources 0 }}|Content: {{ .Content }}`)
|
||||
b.WithTemplates("_default/_markup/render-image.html", `Hook Len Page Resources {{ len .Page.Resources }}`)
|
||||
|
||||
b.Build(BuildCfg{})
|
||||
b.AssertFileContent("public/index.html", `
|
||||
Title: Home|First Resource: data.json|Content: <p>Hook Len Page Resources 1</p>
|
||||
`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user