Omphaloskepsis-2/layouts/partials/single/main-header/dates.html

59 lines
1.6 KiB
HTML
Raw Normal View History

{{- /*
Displays dates for an item.
@params publishDate The date an item was published.
@params lastmodDate The date an item was last modified.
*/
-}}
{{ $publishDate := .publishDate }}
{{ $lastmodDate := .lastmodDate }}
<p class="article-header__publish-date">
Published:
<time
class="dt-published"
datetime="{{ $publishDate | time.Format "2006-01-02T15:04:05-07:00" }}"
itemprop="datePublished"
>{{- $publishDate.Format "January 2" -}}<sup
>{{- if in (slice 1 21 31) $publishDate.Day -}}
st
{{- else if in (slice 2 22) $publishDate.Day -}}
nd
{{- else if in (slice 3 23) $publishDate.Day -}}
rd
{{- else -}}
th
{{- end -}} </sup
>, 1{{- $publishDate.Format "2006" | lang.FormatNumberCustom 0 }}&nbsp;<abbr
style="font-variant: small-caps; font-size: 0.8em;"
title="Holocene Era"
>HE</abbr
></time
>
</p>
<p class="article-header__modified-date">
Last modified:
<time
class="dt-updated"
datetime="{{ $lastmodDate | time.Format "2006-01-02T15:04:05-07:00" }}"
itemprop="dateModified"
>{{- $lastmodDate.Format "January 2" -}}<sup>{{- if in (slice 1 21 31) $lastmodDate.Day -}}
st
{{- else if in (slice 2 22) $lastmodDate.Day -}}
nd
{{- else if in (slice 3 23) $lastmodDate.Day -}}
rd
{{- else -}}
th
{{- end -}}</sup>,
1{{- $lastmodDate.Format "2006" | lang.FormatNumberCustom 0 }}&nbsp;<abbr
style="font-variant: small-caps; font-size: 0.8em;"
title="Holocene Era"
>HE</abbr
></time
>
</p>