hugo-zen icon indicating copy to clipboard operation
hugo-zen copied to clipboard

Fails with latest Hugo / Go 1.6

Open bep opened this issue 8 years ago • 4 comments

Not sure what it is, but the demo site fails:

ERROR: 2016/04/08 22:44:19 template.go:131: template: theme/partials/footer.html:10:70: executing "theme/partials/footer.html" at <safeHTML>: wrong number of args for safeHTML: want 1 got 0 in theme/partials/footer.html
ERROR: 2016/04/08 22:44:19 template.go:131: template: theme/partials/footer.html:10:70: executing "theme/partials/footer.html" at <safeHTML>: wrong number of args for safeHTML: want 1 got 0 in theme/partials/footer.html
ERROR: 2016/04/08 22:44:19 template.go:131: template: theme/partials/footer.html:10:70: executing "theme/partials/footer.html" at <safeHTML>: wrong number of args for safeHTML: want 1 got 0 in theme/partials/footer.html
ERROR: 2016/04/08 22:44:19 template.go:131: template: theme/partials/footer.html:10:70: executing "theme/partials/footer.html" at <safeHTML>: wrong number of args for safeHTML: want 1 got 0 in theme/partials/footer.html
ERROR: 2016/04/08 22:44:19 template.go:131: template: theme/partials/footer.html:10:70: executing "theme/partials/footer.html" at <safeHTML>: wrong number of args for safeHTML: want 1 got 0 in theme/partials/footer.html
ERROR: 2016/04/08 22:44:19 template.go:131: template: theme/partials/footer.html:10:70: executing "theme/partials/footer.html" at <safeHTML>: wrong number of args for safeHTML: want 1 got 0 in theme/partials/footer.html

bep avatar Apr 08 '16 20:04 bep

For what it's worth, I can reproduce this only when all of the following conditions are met:

  • Seems like any version of Hugo/Go e.g. Hugo 1.5 (latest binary release) or Hugo built from 9f6b5ad3b4f2ab7815a475cdf9d7dc354701ebb6 using Go 1.6 (Debian Stretch's package)
  • hugo-zen at 0b977e8800c87eb09c10bff01abb9d0c4c09a2e5 (i.e. before copyright started being pulled from the global config var as opposed to from params)
  • The "copyright" value in [params] is not set

Does it work when you update to the latest hugo-zen or set the "copyright" value in [params]?

justinsteven avatar Apr 09 '16 11:04 justinsteven

I work with getting plenty of themes running on themes.gohugo.io and have limited time to debug individual themes. The use of params in footer should check if it exist before used.

bep avatar Apr 09 '16 12:04 bep

Gotcha. I'm not the author, just a user doing some maintenance.

https://github.com/spf13/HugoBasicExample works fine for me using hugo-zen at current HEAD. It fails using an old commit (hugo-zen at d052d19001b540c8670cccb050cb3fd3f52965c4)

The line in footer that you're kicking out errors on has been changed recently to pull the copyright text from .Site.copyright instead of .Site.Params.copyright which "fixes" the errrors.

Moving the unchecked string out of params might be simply paving over an issue though. Is it a party foul to not bother checking if .Site.copyright exists before using it?

justinsteven avatar Apr 09 '16 12:04 justinsteven

Well, OK, I'll fix it.

rakuishi avatar Oct 25 '16 04:10 rakuishi