From 90caaa368c638ad12e77775152abf986727b9c71 Mon Sep 17 00:00:00 2001 From: zwbetz Date: Sun, 14 Apr 2019 21:24:47 -0500 Subject: [PATCH] Add lastmod to post --- exampleSite/config.toml | 1 + exampleSite/config.yaml | 1 + layouts/post/single.html | 13 ++++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 1bd0698..2110a56 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -5,6 +5,7 @@ title = "Cupper" theme = "cupper-hugo-theme" googleAnalytics = "UA-123456789-1" disqusShortname = "yourdiscussshortname" +enableGitInfo = true [taxonomies] tag = "tags" diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index b24cc8e..23e2ac8 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -5,6 +5,7 @@ title: Cupper theme: cupper-hugo-theme googleAnalytics: UA-123456789-1 disqusShortname: yourdiscussshortname +enableGitInfo: true taxonomies: tag: tags diff --git a/layouts/post/single.html b/layouts/post/single.html index 3374cf4..75191c1 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -6,10 +6,19 @@ {{ .Title }} +
{{ $dateFormat := $.Site.Params.dateFormat | default "Jan 2, 2006" }} - {{ .PublishDate.Format $dateFormat }} + {{ $publishDate := .PublishDate }} + {{ $publishDate.Format $dateFormat }} + {{ with .Lastmod }} + {{ if gt . $publishDate }} +
+ {{ .Format $dateFormat }} + {{ end }} + {{ end }}
+ {{ with .Params.tags }}
@@ -26,9 +35,11 @@
{{ end }} + {{ if ne .Params.toc false }} {{ partial "toc" . }} {{ end }} + {{ .Content }} {{ partial "disqus.html" . }}