Hugoのバージョン0.18より、Gitの履歴情報から記事の最終更新日時(lastmod
)を参照できるようになった。
これまでのHugoにおける最終更新日時の扱い
バージョン0.18よりも前のHugoでは、記事のfrontmatterでlastmod
を明示しない限り、記事の更新日時を使えず、かなり使いにくい機能だった。
0.18以降での最終更新日時の扱い
enableGitInfo
というオプションが追加され、これがtrue
のときにはGitの履歴情報からMarkdownの最終更新日時を自動で取得し、lastmodとして割り当てる機能が追加された。
Add a GitInfo object to Page if enableGitInfo is set. It then also sets Lastmod for the given Page to the author date provided by Git.
https://gohugo.io/release-notes#0-18-0-december-19th-2016
有効化の方法
config.toml
へ1行追加してビルドしなおすだけでOK。
config.toml
enableGitInfo = true
公式ドキュメント
GitInfoの公式ドキュメントはこちら