mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 01:52:07 -05:00
1.1 KiB
1.1 KiB
title | description | categories | keywords | action | aliases | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fmt.Warnidf | Log a suppressible WARNING from a template. |
|
|
{{< new-in 0.123.0 >}}
{{% include "functions/fmt/_common/fmt-layout.md" %}}
The warnidf
function evaluates the format string, then prints the result to the WARNING log. Unlike the warnf
function, you may suppress warnings logged by the warnidf
function by adding the message ID to the ignoreLogs
array in your site configuration.
This template code:
{{ warnidf "warning-42" "You should consider fixing this." }}
Produces this console log:
WARN You should consider fixing this.
You can suppress this warning by adding the following to your site configuration:
ignoreLogs = ['warning-42']
To suppress this message:
{{< code-toggle file=hugo >}} ignoreLogs = ["warning-42"] {{< /code-toggle >}}