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

github.com/mismith0227/hugo_theme_pickles.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormisumi <mismith0227@users.noreply.github.com>2021-12-14 01:45:37 +0300
committerGitHub <noreply@github.com>2021-12-14 01:45:37 +0300
commit60bfdfca51b627c735e72227bd6566ebb0c2012e (patch)
treeabb52198ea048c59b94358bf890667c3ecb61806
parenta9310c65b9b2c713501b797b68e277849a0a05ec (diff)
parent5805195fe8399a99ddb6a944704be230a7a6f116 (diff)
Merge pull request #204 from wilkice/develop
feat: add last modified time to posts
-rwxr-xr-xexampleSite/config.toml6
-rwxr-xr-xlayouts/_default/li.html3
-rw-r--r--layouts/partials/modified_date.html4
3 files changed, 13 insertions, 0 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 3f41391..49fba7c 100755
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -7,10 +7,16 @@ copyright = "&copy; Copyright notice"
# Google Analytics API key.
googleAnalytics = "Your Google Analytics tracking id"
+# enable get info from git commits, such as file modification time.
+# so we don't have to manually update it.
+enableGitInfo = true
+
[params]
paginate = 10
# Hide the date on posts
# hideDate = true
+ # Hide last modified date on posts
+ # hideModifiedDate = true
# Hide the word count on posts and in the posts list
# hideWordCount = true
# Hide the reading time on posts and in the posts list
diff --git a/layouts/_default/li.html b/layouts/_default/li.html
index 7e3c953..de23d6c 100755
--- a/layouts/_default/li.html
+++ b/layouts/_default/li.html
@@ -3,6 +3,9 @@
<h2 class="c-title c-article__title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<p class="c-article__meta">
{{ partial "timestamp.html" . }}
+ {{ if not (.Param "hideModifiedDate") }}
+ | {{ partial "modified_date.html" . }}
+ {{ end }}
{{ if not (.Param "hideWordCount") }}
| {{ partial "word_count.html" . }}
{{ end }}
diff --git a/layouts/partials/modified_date.html b/layouts/partials/modified_date.html
new file mode 100644
index 0000000..76802a9
--- /dev/null
+++ b/layouts/partials/modified_date.html
@@ -0,0 +1,4 @@
+Updated on
+<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
+ {{ .Lastmod.Format "Jan 2, 2006" }}
+</time>