Format for date only, without time, when using 'hugo new...'

If have date = "2006-01-02" in my default.md archetype and run hugo new post blah.md, the resulting file will still get a full datetime value inserted into the date field: date = "2016-05-25T13:43:14-05:00".

Is there a format I can use in my archetype such that when I run hugo new..., the resulting file only shows the date and not the time?

I searched around but couldn’t find an answer for that.

Thanks!

Probably not. Internally Hugo throws your archetype front matter into a typed Go object, updates the fields, and then spits out the results into the new content file. The renderer will always output a full timestamp because of the type of field it gets thrown into in Go.

Bummer. Thanks for the reply.

This works for me

date: {{ dateFormat "2006-01-02" .Date }}
1 Like

Sweet, I’ll give it a try. Thanks for posting!