Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zwbetz-gh/cupper-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzwbetz <zwbetz@gmail.com>2019-04-15 05:24:47 +0300
committerzwbetz <zwbetz@gmail.com>2019-04-15 05:24:47 +0300
commit90caaa368c638ad12e77775152abf986727b9c71 (patch)
treec8424c10f77803524f2da48525569ded09894096
parent3894ae69903811c60a0e32c1b041c18a474cef87 (diff)
Add lastmod to post
-rw-r--r--exampleSite/config.toml1
-rw-r--r--exampleSite/config.yaml1
-rw-r--r--layouts/post/single.html13
3 files changed, 14 insertions, 1 deletions
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 @@
</svg>
{{ .Title }}
</h1>
+
<div class="date">
{{ $dateFormat := $.Site.Params.dateFormat | default "Jan 2, 2006" }}
- <strong aria-hidden="true">Publish date: </strong>{{ .PublishDate.Format $dateFormat }}
+ {{ $publishDate := .PublishDate }}
+ <strong aria-hidden="true">Publish date: </strong>{{ $publishDate.Format $dateFormat }}
+ {{ with .Lastmod }}
+ {{ if gt . $publishDate }}
+ <br>
+ <strong aria-hidden="true">Last mod date: </strong>{{ .Format $dateFormat }}
+ {{ end }}
+ {{ end }}
</div>
+
{{ with .Params.tags }}
<div class="tags">
<strong aria-hidden="true">Tags: </strong>
@@ -26,9 +35,11 @@
</ul>
</div>
{{ end }}
+
{{ if ne .Params.toc false }}
{{ partial "toc" . }}
{{ end }}
+
{{ .Content }}
</main>
{{ partial "disqus.html" . }}