I’m trying to deploy using Netlify. It failed, so I decided to use hugo -v
as the build command, so it would give me some useful information. The only error I received, was this one:
function "now" not defined
When reading through this forum, I read this might be related to an older version of Hugo that doesn’t support the ‘now’ function. So, then I tried to figure out what version of Hugo Netlify uses. That was not so easy, so I tried just using hugo version
as the build command (temporarily). That gave me this output:
Hugo Static Site Generator v0.17 BuildDate: 2018-02-13T22:32:46Z
That looks really old (although the build date is only a few days ago). I have this version locally:
Hugo Static Site Generator v0.36.1 darwin/amd64 BuildDate:
Then I read a blog post detailing how to specify which version to use on Netlify.. I followed all of this advice, and added a config.toml
file to my repository, with this contents:
[context.production.environment]
HUGO_VERSION = "0.36.1"
Then, Netlify says:
Hugo Static Site Generator v0.36.1 linux/amd64 BuildDate: 2018-02-15T09:07:45Z
And now, it works And I realize my question has been aswered now, but perhaps this bit of information might be useful to other people looking to deploy their Hugo blog on Neltify. So I’ll just post it anyway.