diff options
author | Peter Kleiweg <kleiweg@ziggo.nl> | 2022-07-13 14:52:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-13 14:52:19 +0300 |
commit | c097ab90ab82e257d961b4122e690d25aeb1f6ea (patch) | |
tree | 73ad09be419f8aaf844e9c8ee7b36152379fcb21 /layouts | |
parent | 2fbe51c98f2669eadeef8c1c2d00ee158d67a440 (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.html | 16 | ||||
-rw-r--r-- | layouts/_default/single.html | 16 | ||||
-rw-r--r-- | layouts/index.html | 16 |
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 |