是否可以更改Blogdown帖子的日期,以便更新的日期显示在Blog索引页面上?我想继续使用相同的链接更新同一条帖子,而不是使用多份副本,并且让读者知道访问首页时该帖子已被更新。
答案 0 :(得分:0)
Hugo有一个.LastMod
页变量。您可以通过在.Date
中的某个位置将.LastMod
替换为themes/xxx/layouts/_default/list.html
来实现。
请注意,您应该为此仓库启用GIT,以使.Lastmod
正常工作。
一种更安全的方法是重载主题模板:
在list.html
下创建/your-site/layouts/_default/list.html
的副本
将.Date
替换为.Lastmod
例如:
<span class="date">{{ .Date.Format "2006-01-02" }}</span>
<span class="date">{{ .Lastmod.Format "2006-01-02" }}</span>