hugo-theme-more-contentful/layouts/partials/components/post-meta.html

33 lines
1.3 KiB
HTML
Raw Normal View History

2022-04-30 07:46:47 +00:00
{{- /*
The component where it will display the metadata of the post.
This is used on list templates but feel free to change that.
*/ -}}
<div class="list post__meta" aria-hidden="true">
2022-04-30 07:46:47 +00:00
{{- if ne (.PublishDate.Format "2006") "0001" -}}
2022-05-01 12:38:52 +00:00
<time datetime="{{ .PublishDate }}" title="{{ i18n "published_on" }}">
2022-04-30 07:46:47 +00:00
{{ partial "components/heroicon.html" "calendar" }}
<span style="margin-left: 0.5em;">{{ .PublishDate.Format "2006-01-02" }}</span>
</time>
{{- end }}
{{- if and .GitInfo (ne (.PublishDate.Format "2006-01-02") (.Lastmod.Format "2006-01-02")) }}
2022-05-01 12:38:52 +00:00
<time datetime="{{ .Lastmod }}" title="{{ i18n "updated_on" }}">
2022-10-23 16:08:28 +00:00
{{ partial "components/heroicon.html" "arrow-path" }}
2022-04-30 07:46:47 +00:00
<span style="margin-left: 0.5em;">{{ .Lastmod.Format "2006-01-02" }}</span>
</time>
{{- end }}
{{- /* The authors are appended with 'et al' if there's more than one author in the map. */ -}}
{{ with .Params.author }}
{{- $names := slice }}
{{- range . }}{{ $names = $names | append .name }}{{ end }}
{{- $author := index (first 1 $names) 0 }}
2022-05-01 12:38:52 +00:00
<span data-authors="{{ jsonify $names }}" title="{{ i18n "published_by" }}">
2022-04-30 07:46:47 +00:00
{{ partial "components/heroicon.html" "pencil" }}
<span style="margin-left: 0.5em;">
{{ $author }}{{ if ge (len .) 2 }}, et al.{{ end }}
</span>
</span>
{{ end }}
</div>