safeHTML: Wrong number of arguments?

A Hugo site of mine which I have been using quite successfully has recently given me some hiccups:

ERROR: 2015/05/18 template: theme/partials/header.html:18:107: executing "theme/partials/header.html" at <safeHtml>: wrong number of args for safeHtml: want 1 got 0 in theme/partials/header.html

Does anyone have a suggestion for how I can fix this? I haven’t made any changes to the themes or anything … perhaps an auto-update changed my Hugo version from what it was before, but in case its necessary:

$hugo version
Hugo Static Site Generator v0.14-DEV BuildDate: 2015-04-11T14:35:43Z

This has nothing to do with your Hugo version changing.

The error message is pretty clear, but it is hard to say what without seeing the template(s).

Its from the “poopshow” Theme, I think:

<a href="{{ .Site.BaseURL }}" style="text-decoration: none; color: #333;">{{ .Site.Params.blogHeader | safeHtml }}</a>

If you have some string in the blogHeader param, the only explanation I have would be that you build Hugo in the early parts of May – when there were a case insensitive issue with Site.Params. But according to your build date, that is not the case.

Okay I don’t know what I should do then, but maybe check the blogHeader code …

Do you have a blogHeader param set in config.toml?

No, nothing.

$ cat config.toml
BaseURL = "http://seclorum.ddns.net"
languageCode = "en-us"
title = "::seclorum::"
theme = "poopshow"
description = "seclorum"

[Params]
  AuthorName = "seclorum"
  github = "seclorum"
  description = "musings in seclorum"
  email = "myemail@myaddress.xxx"

Okay, so I put one in … and problem solved (besides triggering the safeHTML / safeHtml ERROR…) … so thanks for that. I guess it should be noted that without it, the error occurs?

1 Like

This error message occured in my case because config.toml had missing parameters that theme expected. One way to find this out is to use config.toml from exampleSite inside theme’s folder and see if things work.