HUGO
News Docs Themes Community GitHub

fmt.Erroridf

Log a suppressible ERROR from a template.

Syntax

fmt.Erroridf ID FORMAT [INPUT]

Returns

string

Alias

erroridf

The documentation for Go’s fmt package describes the structure and content of the format string.

The erroridf function evaluates the format string, then prints the result to the ERROR log and fails the build. Unlike the errorf function, you may suppress errors logged by the erroridf function by adding the message ID to the ignoreLogs array in your site configuration.

This template code:

{{ erroridf "error-42" "You should consider fixing this." }}

Produces this console log:

ERROR You should consider fixing this.
You can suppress this error by adding the following to your site configuration:
ignoreLogs = ['error-42']

To suppress this message:

ignoreLogs:
- error-42
ignoreLogs = ['error-42']
{
   "ignoreLogs": [
      "error-42"
   ]
}