diff options
author | Oscar Najera <hi@oscarnajera.com> | 2024-12-28 03:32:36 +0100 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2024-12-28 03:32:36 +0100 |
commit | ad38af9f73351d1e70e78615c09a0bd8f4e77357 (patch) | |
tree | d12faaf50edd27188d35afefb960d9754f82b18b | |
parent | cd2bdb86e66bdb609eeed6526d9b0235b16fd6bd (diff) | |
download | hugo-minimalist-theme-ad38af9f73351d1e70e78615c09a0bd8f4e77357.tar.gz hugo-minimalist-theme-ad38af9f73351d1e70e78615c09a0bd8f4e77357.tar.bz2 hugo-minimalist-theme-ad38af9f73351d1e70e78615c09a0bd8f4e77357.zip |
Localize time
-rw-r--r-- | layouts/404.html | 16 | ||||
-rw-r--r-- | layouts/_default/search.json | 4 | ||||
-rw-r--r-- | layouts/partials/metadata.html | 9 | ||||
-rw-r--r-- | layouts/taxonomy/terms.html | 4 |
4 files changed, 17 insertions, 16 deletions
diff --git a/layouts/404.html b/layouts/404.html index 016a86d..50cf5a3 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -14,15 +14,15 @@ <ul class="list ph5"> {{ range first 10 $query }} <li class="lh-copy stripe-dark ph1 pv2"> - {{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }} - <time - datetime="{{ .Date.Format "2006-01-02" }}" - class="f6 fw3 fr ml2" - > - <i class="far fa-calendar"></i> - {{ .Date.Format $dateFormat }} - </time> <a class="link dim color-inherit" href="{{ .RelPermalink }}"> + {{ $dateFormat := .Site.Params.dateFormat | default ":date_medium" }} + <time + datetime="{{ .Date.Format "2006-01-02" }}" + class="f6 fw3 fr ml2" + > + <i class="far fa-calendar"></i> + {{ time.Format $dateFormat .Date }} + </time> {{ .Title }} </a> </li> diff --git a/layouts/_default/search.json b/layouts/_default/search.json index 16912cb..9fae26d 100644 --- a/layouts/_default/search.json +++ b/layouts/_default/search.json @@ -1,5 +1,5 @@ -{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }} +{{ $dateFormat := .Site.Params.dateFormat | default ":date_medium" }} {{- $.Scratch.Add "index" slice -}} {{- range (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) -}} @@ -7,7 +7,7 @@ "tags" .Params.tags "categories" .Params.categories "contents" (.Summary | plainify) - "date" (.Date.Format $dateFormat) + "date" (time.Format $dateFormat .Date) "permalink" .Permalink) -}} {{- end -}} {{- $.Scratch.Get "index" | jsonify -}} diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html index bb2e4d3..e1408ad 100644 --- a/layouts/partials/metadata.html +++ b/layouts/partials/metadata.html @@ -1,7 +1,7 @@ {{ $dateTime := .PublishDate.Format "2006-01-02" }} -{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }} +{{ $dateFormat := .Site.Params.dateFormat | default ":date_medium" }} <div class="f6 lh-copy mv0 ph4 pv2"> - By — + {{ T "author_by" }} — {{ range .Params.authors }} {{ $name := . }} {{ $path := printf "/%s/%s" "authors" ( $name | urlize ) }} @@ -22,7 +22,7 @@ <br /> <i class="far fa-calendar"></i> <time datetime="{{ $dateTime }}"> - {{ .Date.Format $dateFormat }} + {{ time.Format $dateFormat .Date }} </time> {{ with .Params.location }} — @@ -30,7 +30,8 @@ {{ end }} {{ if eq .Section "post" }} - | {{ .ReadingTime }} mins read + | {{ .ReadingTime }} + {{ i18n "minute_read" }} {{ end }} {{ with .GetTerms "tags" }} diff --git a/layouts/taxonomy/terms.html b/layouts/taxonomy/terms.html index 347e4a5..f2c0895 100644 --- a/layouts/taxonomy/terms.html +++ b/layouts/taxonomy/terms.html @@ -32,13 +32,13 @@ <ul class="list ph5"> {{ range .Pages.ByDate }} <li class="lh-copy stripe-dark ph1 pv2"> - {{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }} + {{ $dateFormat := .Site.Params.dateFormat | default ":date_medium" }} <time datetime="{{ .Date.Format "2006-01-02" }}" class="f6 fw3 fr ml2" > <i class="far fa-calendar"></i> - {{ .Date.Format $dateFormat }} + {{ time.Format $dateFormat .Date }} </time> <a class="link dim color-inherit" href="{{ .RelPermalink }}"> {{ .Title }} |