Rendering lastmod date

I am running into an issue rendering a website using hugo server and was wondering if anyone has helpful insights.

I have this template in _default/single.html

<i class=‘fas fa-calendar’></i> {{ .Page.Lastmod.Format “02/01/2006” }}

and the following front matter:

title = "Standard dir structure for VDEC data analysis projects"
date = 2018-08-25T13:06:25-05:00
weight = 5
lastmod = [":fileModTime", ":default"]

but it always prints the date as in the front matter (2018-08-25) instead of today’s date (I modified the content file today).
if I remove date = 2018-08-25T13:06:25-05:00 from the front matter, it prints an empty date
01/01/0001

what am I missing?

Hugo Static Site Generator v0.47.1/extended darwin/amd64 BuildDate: unknown
update:
same issue with
Hugo Static Site Generator v0.48/extended darwin/amd64 BuildDate: unknown

Please review Requesting Help and share a repo with your site’s project. Then folks can test your issue without building a test site.

I don’t think this is the ISO friendly version Hugo needs.

When referencing in your templates, see .Lastmod here:

Other than that, yes, we need more source to help you out.

The above belongs in config.toml, see Configure Hugo | Hugo

1 Like

Thanks bep,
makes sense,
so lastmode in the front matter is to hardcode the date?!

In a sense. I have written much about this in the past: Using the file mod timestamp will only work if you have one source. Once you distribute this across machines, that timestamp will not represent “author date”. Have a look a the Git integration Hugo provides.

1 Like