I was able to overcome my last issue that I posted about with success, got everything working, then realized that my categories for blogs, were showing a date stamp of “Jan 01, 0001” even though none of the other posts or content would show last mod.
I am using the:
And in particular it only appears on this page (using the demo theme for context):
However, I can’t narrow down the cause. I do know it is git, as if I add ":git",
to lastmod between lastmod
and date
here:
enableGitInfo = true
[FrontMatter]
date = [ "date", "publishDate", "lastmod" ]
lastmod = [ "lastmod", "date", "publishDate" ]
publishDate = [ "publishDate", "date" ]
expiryDate = [ "expiryDate" ]
So:
lastmod = [ "lastmod", ":git", "date", "publishDate" ]
That is when all of the issues start to happen.
I narrowed the codebase down to this section, which uses the lastmod frontmatter date in the blog post:
{{- if ne .Lastmod .Date -}}
<section class="article-lastmod">
{{ partial "helper/icon" "clock" }}
<span>
{{ T "article.lastUpdatedOn" }} {{ .Lastmod.Format ( or .Site.Params.dateFormat.lastUpdated "Jan 02, 2006 15:04 MST" ) }}
</span>
</section>
<section class="article-lastmod">
{{ partial "helper/icon" "hash" }}
<span>
{{ if .IsPage }}<em>{{ with .GitInfo }}| {{ .Subject }} | {{ .AbbreviatedHash }}{{end }}</em>{{ end }}
</span>
</section>
But that section is for a completely different page.
The demo link I gave above, for categories, I believe is using this file:
But I don’t fully understand how git is interfering here:
<footer class="article-time">
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
{{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
</time>
</footer>
When Git is enabled, it doesn’t matter if lastmod in the frontmatter of a blog post is set to any of the following:
date = "2017-06-23"
lastmod = "2019-05-30"
lastmod =
lastmod = ""
The category page will still show January 01, 0001.
The versions of the software I am running are:
$ git version
git version 2.39.3 (Apple Git-145)
$ go version
go version go1.21.5 darwin/arm64
$ hugo version
hugo v0.121.1-00b46fed8e47f7bb0a85d7cfc2d9f1356379b740+extended darwin/arm64 BuildDate=2023-12-08T08:47:45Z VendorInfo=brew
I did read this:
If I set core.quotepath
to false, the issue still persists.
An example can be found here: