diff options
Diffstat (limited to 'docs/content/en/troubleshooting/inspection.md')
-rw-r--r-- | docs/content/en/troubleshooting/inspection.md | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/docs/content/en/troubleshooting/inspection.md b/docs/content/en/troubleshooting/inspection.md index 826229153..e9fc8ed0f 100644 --- a/docs/content/en/troubleshooting/inspection.md +++ b/docs/content/en/troubleshooting/inspection.md @@ -11,10 +11,10 @@ menu: weight: 40 --- -Use the [`jsonify`] function to inspect a data structure: +Use the [`debug.Dump`] function to inspect a data structure: ```go-html-template -<pre>{{ jsonify (dict "indent" " ") .Params }}</pre> +<pre>{{ debug.Dump .Params }}</pre> ``` ```text @@ -32,33 +32,6 @@ Use the [`jsonify`] function to inspect a data structure: } ``` -{{% note %}} -Hugo will throw an error if you attempt to use the construct above to display context that includes a page collection. For example, in a home page template, this will fail: - -`{{ jsonify (dict "indent" " ") . }}` -{{% /note %}} - -Use the [`debug.Dump`] function to inspect data types: - -```go-html-template -<pre>{{ debug.Dump .Params }}</pre> -``` - -```text -maps.Params{ - "date": time.Time{}, - "draft": false, - "iscjklanguage": false, - "lastmod": time.Time{}, - "publishdate": time.Time{}, - "tags": []string{ - "foo", - "bar", - }, - "title": "My first post", -} -``` - Use the [`printf`] function (render) or [`warnf`] function (log to console) to inspect simple data structures. The layout string below displays both value and data type. ```go-html-template @@ -66,7 +39,6 @@ Use the [`printf`] function (render) or [`warnf`] function (log to console) to i {{ printf "%[1]v (%[1]T)" $value }} → 42 (int) ``` -[`jsonify`]: /functions/encoding/jsonify -[`debug.Dump`]: /functions/debug/dump -[`printf`]: /functions/fmt/printf -[`warnf`]: /functions/fmt/warnf +[`debug.Dump`]: /functions/debug/dump/ +[`printf`]: /functions/fmt/printf/ +[`warnf`]: /functions/fmt/warnf/ |