summaryrefslogtreecommitdiffstats
path: root/hugolib/disableKinds_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-02-19 17:37:20 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-02-19 18:22:41 +0100
commit9bdedb251c7cd8f8af800c7d9914cf84292c5c50 (patch)
tree7698705157e9c3363da34d3378d2f0451e29d49e /hugolib/disableKinds_test.go
parentdce210ab56fc885818fc5d1a084a1c3ba84e7929 (diff)
Fix lazy publishing with publishResources=false
Fixes #6914
Diffstat (limited to 'hugolib/disableKinds_test.go')
-rw-r--r--hugolib/disableKinds_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/hugolib/disableKinds_test.go b/hugolib/disableKinds_test.go
index e814f4a5a..3d78e29f3 100644
--- a/hugolib/disableKinds_test.go
+++ b/hugolib/disableKinds_test.go
@@ -32,6 +32,7 @@ disableKinds = [%q]
`, disableKind)
b := newTestSitesBuilder(c)
+ b.WithTemplatesAdded("_default/single.html", `single`)
b.WithConfigFile("toml", config).WithContent("sect/page.md", `
---
title: Page
@@ -281,3 +282,32 @@ home = [ "HTML", "RSS" ]
b.Assert(b.CheckExists("public/index.xml"), qt.Equals, false)
}
+
+func TestBundleNoPublishResources(t *testing.T) {
+ b := newTestSitesBuilder(t)
+ b.WithTemplates("index.html", `
+{{ $bundle := site.GetPage "section/bundle-false" }}
+{{ $data1 := $bundle.Resources.GetMatch "data1*" }}
+Data1: {{ $data1.RelPermalink }}
+
+`)
+
+ b.WithContent("section/bundle-false/index.md", `---\ntitle: BundleFalse
+_build:
+ publishResources: false
+---`,
+ "section/bundle-false/data1.json", "Some data1",
+ "section/bundle-false/data2.json", "Some data2",
+ )
+
+ b.WithContent("section/bundle-true/index.md", `---\ntitle: BundleTrue
+---`,
+ "section/bundle-true/data3.json", "Some data 3",
+ )
+
+ b.Build(BuildCfg{})
+ b.AssertFileContent("public/index.html", `Data1: /section/bundle-false/data1.json`)
+ b.AssertFileContent("public/section/bundle-false/data1.json", `Some data1`)
+ b.Assert(b.CheckExists("public/section/bundle-false/data2.json"), qt.Equals, false)
+ b.AssertFileContent("public/section/bundle-true/data3.json", `Some data 3`)
+}