Update template-debugging.md to include a jsonify example

This commit is contained in:
Martin Hähnel 2023-06-21 11:44:57 +03:00 committed by GitHub
parent 22bca519ba
commit 897812a50c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
<pre>{{ . | jsonify (dict "indent" " ") }}</pre>
```
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: