I’m running Hugo on GitHub Pages w/ the suggested GitHub Actions. However, I’ve just noticed a discrepancy between the behavior of a locally run Hugo and the Hugo run by GitHub actions.
What I first noticed was that the “Last Modified” date for one of my old posts was wrong on GitHub Pages – it was listed as today, not two weeks ago when I actually last changed it. I have enableGitInfo = true
so expected that to be taken from the git info for that page, but it wasn’t right. It was correct on a locally running “development” Hugo instance, but not on the “publication” version on GitHub Pages.
So I did some investigation. I added a stanza in layouts/_default/single
just to print some of the .GitInfo
data at the top of the page, the .Hash
, .Subject
, .CommitDate
, .AuthorDate
, .AuthorEmail
, and .AuthorName
. When run on the local Hugo instance, the gitinfo was printed was that of the commit that last modified the page in question.
When GitHub Actions ran however, what it printed at the top of the page was the latest commit to the blog repository as a whole, even if it had nothing to do with the page I was viewing. (As a most minimal “Noop” repo change, I just added a file with date > static/EPOCH
and committed that.)
Has anyone else noticed this? Am I doing something wrong? Will I have to manually add the relevant “LastModified” date to the frontmatter of my posts/pages? (Which I guess is necessary if you have included figures that change or such w/out changing the page source itself.)