Hello, I am having a problem with using .Lastmod
.
I expect it to return the date given by ":git"
so .GitInfo.AuthorDate
, (because I have it set in config.toml) which is exactly what it does when I use hugo server
or run the command hugo --minify --cleanDestinationDir --gc
dirrectly and host it as a live-server.
However when I build it and deploy it to Github Pages using Github Actions, it instead shows some other date (for some it is the current day and others 01 Jan 01.
Dates on my site: link
Dates using hugo server:
Relevant job in workflow:
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Build
run: hugo --minify --cleanDestinationDir --gc
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: master # deploying branch
cname: plundration.github.io/
Code for getting the date:
{{.Lastmod.Format "02 Jan 06"}}
Lastmod config:
...
enableGitInfo = true
[frontmatter]
lastmod = [":git"]
...
Versions:
hugo v0.104.2+extended linux/amd64 BuildDate=unknown
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.19.1"
git version 2.37.3