【发布时间】:2018-02-08 08:01:26
【问题描述】:
假设我有{{ partial "li.html" $test $root.Data.Term }}。
有了这个,我可以访问第一个参数或$test,只需在li.html 模板中引用.,但我如何从同一个模板?
【问题讨论】:
-
尝试
{{ partial "li.html" (dict "test" $test "Term" $root.Data.Term ) }},然后使用.test和.Term访问它们。基于:https://gohugo.io/functions/dict/
标签: go go-templates hugo