feat(lastmod): use git commit to generate lastmod info (#124)

This commit is contained in:
Gimo 2019-02-14 21:26:50 +09:00 committed by olOwOlo
parent 915174fdba
commit 920e2eb84b
2 changed files with 9 additions and 2 deletions

View file

@ -6,6 +6,7 @@ preserveTaxonomyNames = true
enableRobotsTXT = true
enableEmoji = true
theme = "even"
enableGitInfo = false # use git commit log to generate lastmod record # 可根据 Git 中的提交生成最近更新记录。
# Syntax highlighting by Chroma. NOTE: Don't enable `highlightInClient` and `chroma` at the same time!
pygmentsOptions = "linenos=table"
@ -53,6 +54,9 @@ copyright = "" # default: author.name ↓ # 默认为下面配
debug = false # If true, load `eruda.min.js`. See https://github.com/liriliri/eruda
since = "2017" # Site creation time # 站点建立时间
# use public git repo url to link lastmod git commit, enableGitInfo should be true.
# 指定 git 仓库地址,可以生成指向最近更新的 git commit 的链接,需要将 enableGitInfo 设置成 true.
gitRepo = ""
# site info (optional) # 站点信息(可选,不需要的可以直接注释掉)
logoTitle = "Even" # default: the title value # 默认值: 上面设置的title值

View file

@ -6,7 +6,10 @@
</p>
<p class="copyright-item">
<span class="item-title">{{ T "lastMod" }}</span>
<span class="item-content">{{ .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}</span>
<span class="item-content">
{{ .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}
{{ with .GitInfo }}<a href="{{ $.Site.Params.gitRepo }}/commit/{{ .Hash }}" title="{{ .Subject }}">({{ .AbbreviatedHash }})</a>{{ end }}
</span>
</p>
{{ if $.Site.Params.linkToMarkDown -}}
{{ with $.OutputFormats.Get "markdown" -}}