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

github.com/lxndrblz/anatole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kleiweg <kleiweg@ziggo.nl>2022-07-13 14:52:19 +0300
committerGitHub <noreply@github.com>2022-07-13 14:52:19 +0300
commitc097ab90ab82e257d961b4122e690d25aeb1f6ea (patch)
tree73ad09be419f8aaf844e9c8ee7b36152379fcb21 /layouts
parent2fbe51c98f2669eadeef8c1c2d00ee158d67a440 (diff)
feat: localized dates (#373)
Adds localized dates to the theme. Requires Hugo version 0.87.0v or above.
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/list.html16
-rw-r--r--layouts/_default/single.html16
-rw-r--r--layouts/index.html16
3 files changed, 42 insertions, 6 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 8e0e67b..0f985b5 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -16,11 +16,23 @@
<a class="archive__list-title" href="{{ .RelPermalink }}" title="{{ .Title }}">{{ .Title }}</a>
<div class="archive__list-date">
{{ if isset .Site.Params "listdateformat" }}
- {{ .Date.Format .Site.Params.listDateFormat }}
+ {{ if .Site.Params.localizedDates }}
+ {{ time.Format .Site.Params.listDateFormat .Date }}
+
+ {{ else }}
+ {{ .Date.Format .Site.Params.listDateFormat }}
+
+ {{ end }}
{{ else }}
- {{ .Date.Format "Jan 2" }}
+ {{ if .Site.Params.localizedDates }}
+ {{ time.Format "Jan 2" .Date }}
+
+ {{ else }}
+ {{ .Date.Format "Jan 2" }}
+
+ {{ end }}
{{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index f9ddd5a..c2d2f86 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -22,11 +22,23 @@
<em class="fas fa-calendar-day post__meta-icon"></em>
<span class="post__meta-text"
>{{ if isset .Site.Params "singledateformat" }}
- {{ .Date.Format .Site.Params.singleDateFormat }}
+ {{ if .Site.Params.localizedDates }}
+ {{ time.Format .Site.Params.singleDateFormat .Date }}
+
+ {{ else }}
+ {{ .Date.Format .Site.Params.singleDateFormat }}
+
+ {{ end }}
{{ else }}
- {{ .Date.Format "Mon, Jan 2, 2006" }}
+ {{ if .Site.Params.localizedDates }}
+ {{ time.Format "Mon, Jan 2, 2006" .Date }}
+
+ {{ else }}
+ {{ .Date.Format "Mon, Jan 2, 2006" }}
+
+ {{ end }}
{{ end }}
diff --git a/layouts/index.html b/layouts/index.html
index 486e59f..e8650c4 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -77,11 +77,23 @@
<em class="fas fa-calendar-day"></em>
<span class="post__footer-date"
>{{ if isset .Site.Params "indexdateformat" }}
- {{ .Date.Format .Site.Params.indexDateFormat }}
+ {{ if .Site.Params.localizedDates }}
+ {{ time.Format .Site.Params.indexDateFormat .Date }}
+
+ {{ else }}
+ {{ .Date.Format .Site.Params.indexDateFormat }}
+
+ {{ end }}
{{ else }}
- {{ .Date.Format "Mon, Jan 2, 2006" }}
+ {{ if .Site.Params.localizedDates }}
+ {{ time.Format "Mon, Jan 2, 2006" .Date }}
+
+ {{ else }}
+ {{ .Date.Format "Mon, Jan 2, 2006" }}
+
+ {{ end }}
{{ end }}</span