hugo-theme/layouts/partials/block/time.html

28 lines
887 B
HTML

{{ $showDate := (.Params.showDate) | default true }}
{{- if .Date | and $showDate }}
<div class="flex flex-col gap-y-1 md:flex-row md:gap-y-0 md:gap-x-4 text-slate-500 dark:text-slate-300">
{{- if .Date }}
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := .Date | time.Format ($.Site.Params.DateFormatList | default "2006-01-02") }}
<div class="flex flex-row text-base gap-x-1">
<i class="h-6 w-6 flex-none">
{{ partial "icon.html" "calendar" }}
</i>
<time datetime="{{ $dateMachine }}">
{{ $dateHuman }}
</time>
</div>
{{ end -}}
{{- if $.Site.Params.showReadingTime }}
<div class="flex flex-row text-base gap-x-1">
<i class="h-6 w-6 flex-none">
{{ partial "icon.html" "hourglass-high" }}
</i>
<span>
{{ T "reading_time" .ReadingTime }}
</span>
</div>
{{ end -}}
</div>
{{ end -}}