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

28 lines
880 B
HTML
Raw Normal View History

2024-10-21 22:58:18 +02:00
{{ $showDate := (.Params.showDate) | default true }}
{{- if .Date | and $showDate }}
2024-10-21 13:47:30 +02:00
<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.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>
2024-10-21 22:58:18 +02:00
{{ end -}}