mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'
This commit is contained in:
@@ -1,30 +1,22 @@
|
||||
---
|
||||
title: fmt.Warnf
|
||||
linkTitle: warnf
|
||||
description: Log a WARNING from a template.
|
||||
categories: [functions]
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
function:
|
||||
action:
|
||||
aliases: [warnf]
|
||||
related:
|
||||
- functions/fmt/Errorf
|
||||
- functions/fmt/Erroridf
|
||||
returnType: string
|
||||
signatures: ['fmt.Warnf FORMAT [INPUT]']
|
||||
relatedFunctions:
|
||||
- fmt.Errorf
|
||||
- fmt.Erroridf
|
||||
- fmt.Warnf
|
||||
aliases: [/functions/warnf]
|
||||
---
|
||||
|
||||
The documentation for [Go's fmt package] describes the structure and content of the format string.
|
||||
{{% include "functions/fmt/_common/fmt-layout.md" %}}
|
||||
|
||||
Like the [`printf`] function, the `warnf` function evaluates the format string. It then prints the result to the WARNING log. Hugo prints each unique message once to avoid flooding the log with duplicate warnings.
|
||||
The `warnf` function evaluates the format string, then prints the result to the WARNING log. Hugo prints each unique message once to avoid flooding the log with duplicate warnings.
|
||||
|
||||
```go-html-template
|
||||
{{ warnf "Copyright notice missing from site configuration" }}
|
||||
{{ warnf "The %q shortcode was unable to find %s. See %s" .Name $file .Position }}
|
||||
```
|
||||
|
||||
[`printf`]: /functions/fmt/printf
|
||||
[Go's fmt package]: https://pkg.go.dev/fmt
|
||||
|
Reference in New Issue
Block a user