A question about .Date and it's inclusion location

I have enabled 2 places where I am accessing .Date in my template, one in single.html in the _default partial and the other in a partial called page_meta.html which is included in my footer.

Both case are doing this…

{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := .Date | time.Format ":date_long" }}
<time datetime="{{ $dateMachine }}" class="{{- if ne site.Params.showDate true }}hidden{{- end }}">{{ $dateHuman }}</time>

These have different dates, and I can’t figure out why –

You can look at this on my theme here – Leaflet Maps | The Ryder Theme and there is a link to the source from that page if you want to take a look under the hood.

Thank You in advance for any help.

The correct date matching front matter is below the article title, the incorrect date is the one in the footer.

You’re caching the footer.

1 Like

Thank you sir! See what premature optimization gets you! I did that before I understood really what it did. I am pretty new to Hugo and really enjoying working with it.

That fixed my problem.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.