aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/cascade_test.go
diff options
context:
space:
mode:
authorCathrine Paulsen <[email protected]>2022-04-05 07:41:24 +0000
committerGitHub <[email protected]>2022-04-05 09:41:24 +0200
commitda00e7714e0233d5cba73bc3c4cf7331304ccb20 (patch)
tree65609a1e27b98a5a5cc02426ef1c6ec4955c7265 /hugolib/cascade_test.go
parented9aa374dd5e18fbfb207a0a10cde2362061c8ca (diff)
downloadhugo-da00e7714e0233d5cba73bc3c4cf7331304ccb20.tar.gz
hugo-da00e7714e0233d5cba73bc3c4cf7331304ccb20.zip
Add environment as a new filter to _cascade.target
Fixes #9612
Diffstat (limited to 'hugolib/cascade_test.go')
-rw-r--r--hugolib/cascade_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/hugolib/cascade_test.go b/hugolib/cascade_test.go
index c218aa282..0a7f66e6c 100644
--- a/hugolib/cascade_test.go
+++ b/hugolib/cascade_test.go
@@ -550,6 +550,32 @@ S1|p1:|p2:p2|
`)
})
+ c.Run("slice with environment _target", func(c *qt.C) {
+ b := newBuilder(c)
+
+ b.WithContent("_index.md", `+++
+title = "Home"
+[[cascade]]
+p1 = "p1"
+[cascade._target]
+path="**p1**"
+environment="testing"
+[[cascade]]
+p2 = "p2"
+[cascade._target]
+kind="section"
+environment="production"
++++
+`)
+
+ b.Build(BuildCfg{})
+
+ b.AssertFileContent("public/index.html", `
+P1|p1:|p2:|
+S1|p1:|p2:p2|
+`)
+ })
+
c.Run("slice with yaml _target", func(c *qt.C) {
b := newBuilder(c)