diff options
author | tdro <tdro@noreply.example.com> | 2023-10-07 20:19:06 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-10-07 20:19:06 -0400 |
commit | c83c49b0e18f0593a62a8a7754d1ff49ac097289 (patch) | |
tree | ecf67e580ce99de31816573afd88fdff5e57bfcb /themes/default/layouts | |
parent | 6f2f44c7ff0e3ff8ffd4e6bb394a0b39c0f89adf (diff) | |
download | canory-c83c49b0e18f0593a62a8a7754d1ff49ac097289.tar.gz canory-c83c49b0e18f0593a62a8a7754d1ff49ac097289.tar.bz2 canory-c83c49b0e18f0593a62a8a7754d1ff49ac097289.zip |
themes/default: Make time and dates consistent
Don't mix local time with UTC and fix future date calculation
Diffstat (limited to 'themes/default/layouts')
9 files changed, 19 insertions, 19 deletions
diff --git a/themes/default/layouts/_default/home.archives.html b/themes/default/layouts/_default/home.archives.html index a49b96d..3b5c94b 100644 --- a/themes/default/layouts/_default/home.archives.html +++ b/themes/default/layouts/_default/home.archives.html @@ -25,7 +25,7 @@ <item-list> {{ range (.Paginator.Pages.GroupByDate "2006") }} {{ range (first 1 .Pages) }} - <h1>{{ .Date.Format "2006" }}</h1> + <h1>{{ .Date | time.Format "2006" }}</h1> {{ end }} <ul> {{ range .Pages }} @@ -36,7 +36,7 @@ href="{{ .Permalink }}#{{ partial "card-id.html" . }}" > <span> - <code title="{{ .Date | time.Format "Posted: Monday, January 2, 2006 at 15:04:05 MST" }}">{{ .Date.Format "02 Jan" }}</code> + <code title="{{ .Date | time.Format "Posted: Monday January 2 2006 at 15:04:05 MST" }}">{{ .Date | time.Format "02 Jan" }}</code> </span> <span>{{ partial "meta-title.html" . }}</span> <span>@{{ $author.user }}</span> diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml index 8cb5276..717656b 100644 --- a/themes/default/layouts/_default/rss.xml +++ b/themes/default/layouts/_default/rss.xml @@ -8,10 +8,10 @@ {{- $limit = .Paginator.TotalNumberOfElements -}} {{- end -}} -{{- $lastBuildDate := now.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} +{{- $lastBuildDate := now | time.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} {{- if not .Date.IsZero -}} - {{- $lastBuildDate = .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} + {{- $lastBuildDate = .Date | time.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} {{- end -}} {{- $title := partial "base-title.html" . -}} @@ -94,7 +94,7 @@ <item> <title>{{ (or .Summary .Title) | htmlUnescape }}</title> <link>{{ .Permalink }}</link> - <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + <pubDate>{{ .Date | time.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <guid>{{ .Permalink }}</guid> <description> {{ partial "function-content.html" . | html -}} diff --git a/themes/default/layouts/_default/section.following.html b/themes/default/layouts/_default/section.following.html index 9a44478..bb1b920 100644 --- a/themes/default/layouts/_default/section.following.html +++ b/themes/default/layouts/_default/section.following.html @@ -51,7 +51,7 @@ <time title="{{ $distinct.FeedDateTitle }}" datetime="{{ $distinct.FeedDateTime }}"> - {{ $distinct.FeedDateTime | time.Format "15:04 Jan 2 2006" -}} + {{ $distinct.FeedDate -}} </time> </micro-header> <a diff --git a/themes/default/layouts/_default/sitemap.xml b/themes/default/layouts/_default/sitemap.xml index c47d1db..f8ab315 100644 --- a/themes/default/layouts/_default/sitemap.xml +++ b/themes/default/layouts/_default/sitemap.xml @@ -3,7 +3,7 @@ {{- $changefreq := "weekly" -}} {{- $priority := 0.5 -}} -{{- $lastmod := now.Format "2006-01-02T15:04:05-07:00" }} +{{- $lastmod := now | time.Format "2006-01-02T15:04:05-07:00" }} <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" @@ -21,7 +21,7 @@ {{- end -}} {{- if not .Lastmod.IsZero -}} - {{- $lastmod = safeHTML (.Lastmod.Format "2006-01-02T15:04:05-07:00") -}} + {{- $lastmod = safeHTML (.Lastmod | time.Format "2006-01-02T15:04:05-07:00") -}} {{- end }} <url> diff --git a/themes/default/layouts/_default/taxonomy.html b/themes/default/layouts/_default/taxonomy.html index 9ec1cb7..6a8325b 100644 --- a/themes/default/layouts/_default/taxonomy.html +++ b/themes/default/layouts/_default/taxonomy.html @@ -47,7 +47,7 @@ datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}" title="{{ .Date | time.Format "Posted: Monday, January 2, 2006 at 15:04:05 MST" }}" > - {{ .Date.Format "02 Jan 2006" }} + {{ .Date | time.Format "02 Jan 2006" }} </time> <p> <a data-hover href="{{ print ("" | absURL) "/tags/" $title "/#" (partial "card-id.html" .) }}"> diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html index 985f53a..02ab0b2 100644 --- a/themes/default/layouts/partials/author-card.html +++ b/themes/default/layouts/partials/author-card.html @@ -1,5 +1,5 @@ {{- $metadata := print "public/" .Data.user "/author.json" -}} -{{- $date := .Date.Local.Format "15:04 Jan 2 2006" -}} +{{- $date := .Date | time.Format "Mon Jan 2 2006" -}} {{- $host := (urls.Parse ("" | absURL)).Host -}} @@ -66,8 +66,8 @@ </a> </h3> <time - title="{{ .Date.Format "Monday, January 2 2006 at 15:04:05 MST" }}" - datetime="{{ .Date.Format "2006-01-02T15:04:05Z" }}" + title="{{ .Date | time.Format "Monday January 2 2006 at 15:04:05 MST" }}" + datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}" > {{ $date }} </time> diff --git a/themes/default/layouts/partials/base-footer.html b/themes/default/layouts/partials/base-footer.html index a29ff93..d83f07c 100644 --- a/themes/default/layouts/partials/base-footer.html +++ b/themes/default/layouts/partials/base-footer.html @@ -5,7 +5,7 @@ {{- with .Site.Author.footer -}} {{- if $kind -}} {{ . | markdownify }} · - Copyright © {{ now.Format "2006"}} · + Copyright © {{ now | time.Format "2006"}} · {{- else -}} {{ or $author.footer $author.title | markdownify }} · {{- end -}} diff --git a/themes/default/layouts/partials/function-generate-feeds.html b/themes/default/layouts/partials/function-generate-feeds.html index 32f340d..348a8e9 100644 --- a/themes/default/layouts/partials/function-generate-feeds.html +++ b/themes/default/layouts/partials/function-generate-feeds.html @@ -19,7 +19,7 @@ {{- with $fetch | transform.Unmarshal -}} {{- $content := "" -}} - {{- $date := now.Format "2006-01-02T15:04:05Z" -}} + {{- $date := now | time.Format "2006-01-02T15:04:05Z" -}} {{- $description := "" -}} {{- $enclosure := "" -}} {{- $imageLink := "" -}} @@ -160,9 +160,9 @@ $feeds = $feeds | append (dict "FeedContent" ($content | plainify | html | htmlUnescape) "FeedContentShort" (delimit (first 2 (split ($content | plainify | html | htmlUnescape) "\n")) " " | truncate 250) - "FeedDate" ($date | plainify | html | htmlUnescape | time.Format "January 2, 2006") + "FeedDate" ($date | plainify | html | htmlUnescape | time.Format "Mon Jan 2 2006") "FeedDateTime" ($date | plainify | html | htmlUnescape | time.Format "2006-01-02T15:04:05Z") - "FeedDateTitle" ($date | plainify | html | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST") + "FeedDateTitle" ($date | plainify | html | htmlUnescape | time.Format "Monday January 2 2006 at 15:04:05 MST") "FeedDescription" ($description | plainify | html | htmlUnescape) "FeedDescriptionShort" (delimit (first 2 (split ($description | plainify | html | htmlUnescape) "\n")) " " | truncate 250) "FeedEnclosure" ($enclosure | plainify | html | htmlUnescape) diff --git a/themes/default/layouts/partials/meta-date-time.html b/themes/default/layouts/partials/meta-date-time.html index 5b26c68..1dc50f3 100644 --- a/themes/default/layouts/partials/meta-date-time.html +++ b/themes/default/layouts/partials/meta-date-time.html @@ -1,9 +1,9 @@ <micro-metadata-datetime -title="{{ .Date | time.Format "Posted: Monday, January 2, 2006 at 15:04:05 MST" }} -{{ if .Lastmod.After .Date }}{{ .Lastmod | time.Format "Edited: Monday, January 2, 2006 at 15:04:05 MST" }}{{ end }}"> +title="{{ .Date | time.Format "Posted: Monday January 2 2006 at 15:04:05 MST" }} +{{ if .Lastmod.After .Date }}{{ .Lastmod | time.Format "Edited: Monday January 2 2006 at 15:04:05 MST" }}{{ end }}"> {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/calendar.svg")) -}} <time datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}"> - {{ (.Date.Local | time.Format "15:04 Jan 2 2006") -}} + {{ (.Date | time.Format "Mon Jan 2 2006") -}} </time> {{- /* This comment removes trailing newlines and white spaces. */ -}} {{ if .Lastmod.After .Date }} |