Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-12-02 23:10:27 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-12-03 02:13:47 +0300
commit0efb00c2a86ec3f52000a643f26f54bb2a9dfbd6 (patch)
tree370d64135277eaa825ead0c25d33e99eb218087e /hugolib
parent40a092b0687d44ecb53ef1fd53001a6299345780 (diff)
tpl/partials: Allow any key type in partialCached
Fixes #6572
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/template_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/hugolib/template_test.go b/hugolib/template_test.go
index de93f1c80..71b4b46c0 100644
--- a/hugolib/template_test.go
+++ b/hugolib/template_test.go
@@ -308,3 +308,26 @@ complex: 80: {{ partial "complex.tpl" 38 }}
)
}
+
+func TestPartialCached(t *testing.T) {
+ b := newTestSitesBuilder(t)
+
+ b.WithTemplatesAdded(
+ "index.html", `
+{{ $key1 := (dict "a" "av" ) }}
+{{ $key2 := (dict "a" "av2" ) }}
+Partial cached1: {{ partialCached "p1" "input1" $key1 }}
+Partial cached2: {{ partialCached "p1" "input2" $key1 }}
+Partial cached3: {{ partialCached "p1" "input3" $key2 }}
+`,
+ "partials/p1.html", `partial: {{ . }}`,
+ )
+
+ b.Build(BuildCfg{})
+
+ b.AssertFileContent("public/index.html", `
+ Partial cached1: partial: input1
+ Partial cached2: partial: input1
+ Partial cached3: partial: input3
+`)
+}