From 897812a50ca3ebaf5e7e69461b7f943daeb7068b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20H=C3=A4hnel?= <56148301+finn-matti@users.noreply.github.com> Date: Wed, 21 Jun 2023 11:44:57 +0300 Subject: [PATCH] Update template-debugging.md to include a jsonify example --- content/en/templates/template-debugging.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/content/en/templates/template-debugging.md b/content/en/templates/template-debugging.md index 0f32fa732..f40234118 100644 --- a/content/en/templates/template-debugging.md +++ b/content/en/templates/template-debugging.md @@ -44,6 +44,14 @@ When developing a [homepage], what does one of the pages you're looping through {{ end }} ``` +In some cases it might be more helpful to use the following snippet on the current context to get a pretty printed view of what you're able to work with: + +```go-html-template +
{{ . | jsonify (dict "indent" " ") }}
+``` + +Note that Hugo will throw an error if you attempt to use this construct to display context that includes a page collection (e.g., the context passed to home, section, taxonomy, and term templates). + ## Why Am I Showing No Defined Variables? Check that you are passing variables in the `partial` function: