How to get a footer with build time?

I would like hugo to display the build time, when the website was generated, how can I do this currently. Is there a global time.Now variable hugo passes to the templates ?

There’s a PR in the works for that.

Hi. Are you asking for the date/time the build started or the amount of time it took to run the build?

{{ .Now }}

Is available everywhere - and is a Go time.Time set at site generation time.

Thanks every one, the hugo build time will be useful that pull request looks great.

I was looking for {{ .Now }} which is the time the static website was built. That should be enough for now.

The {{ .Now }} uses go’s default time Formatting, which is not very usable. It would be sweet if it sent in a more human readable format or sent all well known formats, which the developer can use in the template.

You can format it as you please:

{{ .Now.Format “Jan 2, 2006 at 3:04pm (MST)” }}



@sheki I misunderstood when I read Build Time for Hugo build time, so @bjornerik nailed it. This may be a little nitpicky, but {{ .Now }} will return a different time every time you call it. Hugo builds fast enough that it will just be a few milliseconds apart, but it isn’t a constant value throughout the build process, as you can see from the Now() function.

func (n *Node) Now() time.Time {
	return time.Now()

As a sidenote, it will also return the time in the timezone the build machine is set to, not UTC.

1 Like

For anyone else coming across this thread, if you are using version 0.19-DEV or a stable release after 0.18.x, {{ .Now }} is deprecated. You should use {{ now }}.


Also noting that the internal RSS template does not seem to use this but rather uses .Date as the lastBuildDate which doesn’t seem right to me. Ref.

I agree! I thought that only I cared about that :slight_smile:.

@bep OK to submit a PR to fix the template for “lastBuildDate” in internal RSS template to use now as @TotallyInformation noted?

1 Like

Ha! OCD is a terrible curse :nerd_face:

I’ve realised that I need to amend a number of the internal templates and shortcodes to meet my own requirements. Great to have the starting points though.

I forgot to mention that the existing form has probably messed up a lot of RSS feeds for a long time. I noted in some of my feeds that the date was a long time in the past. Maybe the first page that is accessed?