Can I generate a warning instead of an error?

When building with Hugo, it can print WARN and ERROR messages, depending on the issue. I know about errorf but is there a way to just emit a warning (in my case from a shortcode) and not have the build fail?

Not in general. You wrap your build in a hugo || echo "Failed" or something in bash if you want to ignore the exit code.

I see. My interest is in emitting a WARN of my own design, not in circumventing ERRORs/build failure in existing logic.

Edit: to clarify, I mean something akin to this:

{{ if non_serious_issue }}
  {{ warnf "User defined warning" }}
{{ end }}
1 Like

OK, then I see. Yes, a warnf func would be useful.

1 Like