refactor: split single header and meta components into partials
This commit is contained in:
parent
d0577aec91
commit
e6889cabba
22 changed files with 742 additions and 406 deletions
58
layouts/partials/single/main-header/dates.html
Normal file
58
layouts/partials/single/main-header/dates.html
Normal file
|
@ -0,0 +1,58 @@
|
|||
{{- /*
|
||||
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 }} <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 }} <abbr
|
||||
style="font-variant: small-caps; font-size: 0.8em;"
|
||||
title="Holocene Era"
|
||||
>HE</abbr
|
||||
></time
|
||||
>
|
||||
</p>
|
Loading…
Add table
Add a link
Reference in a new issue