From 07846d91aadad8f0a1d7ec8d52162ec8aec36e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Zaj=C4=85czkowski?= Date: Mon, 9 Mar 2020 18:34:04 +0100 Subject: [PATCH] [ZZO] Display modification date only if different than creation date Also take into account .lastmod set in file, not only .GitInfo (which still has precedence in default configuration). --- layouts/partials/body/infos.html | 9 ++++++++- layouts/partials/summary/classic.html | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/layouts/partials/body/infos.html b/layouts/partials/body/infos.html index efe7841..4995e3e 100644 --- a/layouts/partials/body/infos.html +++ b/layouts/partials/body/infos.html @@ -1,6 +1,13 @@ {{ $params := .Params }}
- {{ if .GitInfo }}    {{ end }} · ☕ {{ .ReadingTime }} {{ i18n "reading-time" }} {{ with .Params.Author }}· {{if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}✍️{{ end }} {{ . }}{{ end }} + + {{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }} +    + {{ end }} + · ☕ {{ .ReadingTime }} {{ i18n "reading-time" }} + {{ with .Params.Author }} + · {{if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}✍️{{ end }} {{ . }} + {{ end }} {{ if (and .Site.Params.enableBusuanzi .Site.Params.busuanziPagePV) }} · 👀... {{ i18n "counter-page-pv" }}{{ end }} diff --git a/layouts/partials/summary/classic.html b/layouts/partials/summary/classic.html index 4bf5bf8..5ea47a3 100644 --- a/layouts/partials/summary/classic.html +++ b/layouts/partials/summary/classic.html @@ -18,7 +18,14 @@
{{ .Title }}
-
{{ if .GitInfo }} {{ end }} · ☕ {{ .ReadingTime }} {{ i18n "reading-time" }} {{ with $.Param "author" }}· {{if $.Param "authorEmoji" }}{{ $.Param "authorEmoji" }}{{ else }}✍️{{ end }} {{ . }}{{ end }}
+
+ + {{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }} + + {{ end }} + · ☕ {{ .ReadingTime }} {{ i18n "reading-time" }} + {{ with $.Param "author" }}· {{if $.Param "authorEmoji" }}{{ $.Param "authorEmoji" }}{{ else }}✍️{{ end }} {{ . }}{{ end }} +