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.
This commit is contained in:
parent
b51aca950c
commit
edd6eb996b
11 changed files with 123 additions and 58 deletions
25
layouts/partials/page/date.html
Normal file
25
layouts/partials/page/date.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{/*
|
||||
|
||||
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>
|
Loading…
Add table
Add a link
Reference in a new issue