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

github.com/puresyntax71/hugo-theme-chunky-poster.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpuresyntax71 <34715246+puresyntax71@users.noreply.github.com>2020-11-13 06:58:03 +0300
committerGitHub <noreply@github.com>2020-11-13 06:58:03 +0300
commitaa84aca561b0cbba614e497a12af32ceff8c81d3 (patch)
tree18191b17a28deb1729c5856f56930fda3bc18244
parent382acf32f270dcf3e79580d2db5a90da53cf552e (diff)
parent2772af7d03bb4b209758c45f0845274c218837bc (diff)
Merge pull request #137 from abshoff/make-date-format-configurable
Make date format configurable
-rwxr-xr-xexampleSite/config.toml1
-rw-r--r--layouts/_default/card.html2
-rw-r--r--layouts/index.html2
-rw-r--r--layouts/post/single.html2
4 files changed, 4 insertions, 3 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index eda5ab2..257d29d 100755
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -32,6 +32,7 @@ author = "authors"
author = "Hugo Authors"
description = "Lorem ipsum dolor sit amet."
homepageImage = "/images/homepage-image.jpg"
+ dateFormat = "January 2, 2006"
share = true
showLanguageSwitcher = false
diff --git a/layouts/_default/card.html b/layouts/_default/card.html
index 191e15b..e247d8d 100644
--- a/layouts/_default/card.html
+++ b/layouts/_default/card.html
@@ -12,7 +12,7 @@
{{- end -}}
<div class="card-body">
<h4 class="card-title">{{ $page.Title }}</h4>
- <p class="card-text text-muted text-uppercase">{{ $page.Date.Format "January 2, 2006" }}</p>
+ <p class="card-text text-muted text-uppercase">{{ $page.Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</p>
<div class="card-text">
{{ $page.Summary | plainify }}
</div>
diff --git a/layouts/index.html b/layouts/index.html
index e048e7c..168373e 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -34,7 +34,7 @@
{{- end -}}
</div>
<div class="col-lg-6 mb-3">
- <h5 class="created text-muted text-uppercase font-weight-bold">{{ $page.Date.Format "January 2, 2006" }}</h5>
+ <h5 class="created text-muted text-uppercase font-weight-bold">{{ $page.Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</h5>
<h2><a href="{{ $page.RelPermalink }}">{{ $page.Title }}</a></h2>
<div class="content">
diff --git a/layouts/post/single.html b/layouts/post/single.html
index e425da4..73ed53d 100644
--- a/layouts/post/single.html
+++ b/layouts/post/single.html
@@ -7,7 +7,7 @@
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="meta text-muted mb-3">
- <p class="created text-muted text-uppercase font-weight-bold mb-1">{{ $page.Date.Format "January 2, 2006" }}</p>
+ <p class="created text-muted text-uppercase font-weight-bold mb-1">{{ $page.Date.Format (.Site.Params.dateFormat | default "January 2, 2006") }}</p>
<span class="mr-2"><i class="fas fa-book-open mr-2"></i>{{ T "wordCount" $page.WordCount }}</span>
<span><i class="fas fa-clock mr-2"></i>{{ T "readingTime" $page.ReadingTime }}</span>
</div>