hugo-theme-termlite/layouts/partials/page/date.html
Eryn Wells edd6eb996b A more generic tag/value component
Write styles and templates for a more generic tag/value component. Use this component
for the taxonomy lists, draft tag, and page dates in the summary template.
2024-10-12 10:45:52 -07:00

25 lines
635 B
HTML

{{/*
Outputs a date tag for a page.
@context {Page} .page The current page
@context {String} .date The date, one of "published", or "updated".
@context {String} .class Additional classes to apply to the rendered content.
*/}}
{{- $page := .page -}}
{{- $dateName := .date -}}
{{- $name := "" -}}
{{- $date := $page.Date -}}
{{- if or (not $dateName) (eq $dateName "date") }}
{{- $name = T "datePublishedName" -}}
{{- else -}}
{{ end -}}
<div class="{{ with .class }}{{ . }} {{ end }}tag">
<span class="tag__name">{{ $name }}</span>
<span class="tag__value">{{ $date | time.Format "2006-01-02" }}</span>
</div>