mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
tpl: Add errorf template function
Add template function that will build a string from the given format string and arguments, then log it to ERROR. This has an intended side-effect of causing the build to fail, when executed. Resolves #3817
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
47fdfd5196
commit
4fc67fe44a
@@ -50,8 +50,14 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
return ns
|
||||
ns.AddMethodMapping(ctx.Errorf,
|
||||
[]string{"errorf"},
|
||||
[][2]string{
|
||||
{`{{ errorf "%s." "failed" }}`, `failed.`},
|
||||
},
|
||||
)
|
||||
|
||||
return ns
|
||||
}
|
||||
|
||||
internal.AddTemplateFuncsNamespace(f)
|
||||
|
Reference in New Issue
Block a user