如何检查 Hugo 中当前范围内的变量?

How to inspect variables in the current scope in Hugo?

我想看看“点”下有哪些变量可用。

根据 the docs{{ printf "%#v" . }} 是我要找的。

但是好像只是打印了一堆内存地址。

例如,在点包含 .Params 和一堆其他变量的地方,这就是 {{ printf "%#v" . }} 产生的结果:

&hugolib.pageState{pageOutputs:[]*hugolib.pageOutput{(*hugolib.pageOutput)(0xc0008cad80),
(*hugolib.pageOutput)(0xc0008cafc0)},
pageOutput:(*hugolib.pageOutput)(0xc0008cad80),
pageCommon:(*hugolib.pageCommon)(0xc00052b400)}

我不确定那是什么,但它没有提到当前上下文中可用的内容。

所以我在 Hugo's discourse community 中问了同样的问题,Bjørn Erik Pedersen(雨果的创造者)建议如下:

 {{ debug.Dump . }}

 {{ . | jsonify (dict "indent" " ") }}

后者我运气更好。