February 9, 2023, 5:43am
I am trying to update a post via command. E.g. I created a post via
hugo new post/test.md, and I will get
If I don’t update the time
lastmod by manually changing, how should I do? I would like the time
lastmod is updated automatically when I open it via a command.
That is not possible.
I would remove
.Lastmod from front matter.
When you access
.Lastmod from a template, the returned value will depend on your
site configuration. For example:
lastmod = ['lastmod', ':git', ':fileModTime', 'date', 'publishDate']
The template will first look for the
.Lastmod value in front matter. If it can’t find that, it will use the latest Git author date. If it can’t find that, it will use the file modification time from the file system, etc.
February 11, 2023, 2:35am
I see, thank you so much.
If you want to access the commit date, you need to set
enableGitInfo = true in your site configuration.
February 11, 2023, 5:28am
Thank you, I read the help doc
Site Configuration you gave, and solved the this question.
February 13, 2023, 5:29am
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.