Use git commit for lastmod values
Closed this issue · 8 comments
Configure hugo to use git commit timestamps for lastmod values instead of manually populating
https://gohugo.io/variables/git/
https://mertbakir.gitlab.io/hugo/last-modified-date-in-hugo/
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This doesn't appear to work. All pages seem to reflect the latest global commit date for the repo.
^^ will check.
I think it's actually working correctly, the only problem is in the commit I did remove all existing lastmod
entries, and because these files were thus changed, they all point to the same date.
Tough, when building locally I can confirm that each file has it's own timestamp, based on git:
npm run build
# and checking on a few files:
git log -1 --format=%cd ./content/en/privacy-policy/_index.md
# => Tue Jan 31 10:47:17 2023 +0100
git log -1 --format=%cd ./content/en/device-support/_index.md
# => Wed Feb 22 19:45:57 2023 +0000
git log -1 --format=%cd ./content/en/about/roadmap.md
# => Wed Feb 22 19:45:57 2023 +0000
Screenshots from local build
OK, now we wait.
Confirmed that this is not working correctly. I modified a single page today (127875e) and all pages now reflect today's date.
This seems to be the cause: https://www.brycewray.com/posts/2022/06/get-good-git-info-hugo/
Confirmed fixed with 6409236