From 920e2eb84bb874a9e48062b1bf4032c8b9c4141a Mon Sep 17 00:00:00 2001
From: Gimo
Date: Thu, 14 Feb 2019 21:26:50 +0900
Subject: [PATCH] feat(lastmod): use git commit to generate lastmod info (#124)
---
exampleSite/config.toml | 4 ++++
layouts/partials/post/copyright.html | 7 +++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 8fed952..4ebad8b 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -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值
diff --git a/layouts/partials/post/copyright.html b/layouts/partials/post/copyright.html
index cd42d68..35a7609 100644
--- a/layouts/partials/post/copyright.html
+++ b/layouts/partials/post/copyright.html
@@ -6,7 +6,10 @@
{{ T "lastMod" }}
- {{ .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}
+
+ {{ .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}
+ {{ with .GitInfo }}({{ .AbbreviatedHash }}){{ end }}
+
{{ if $.Site.Params.linkToMarkDown -}}
{{ with $.OutputFormats.Get "markdown" -}}
@@ -29,4 +32,4 @@
{{- end }}
-{{- end }}
\ No newline at end of file
+{{- end }}