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

39 lines
1.4 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.
*/ -}}
{{- if or .PublishDate .Lastmod }}
{{- $RFC3339 := "2006-01-02T15:04:05Z07:00" }}
<div class="site__list post__meta" aria-hidden="true">
{{- if .PublishDate -}}
<span class="post__meta-icon-label">
{{ partial "components/heroicon.html" (dict "id" "calendar") }}
<time datetime="{{ .PublishDate.Format $RFC3339 }}" title="{{ i18n "published_on" }}">
{{ .PublishDate.Format "2006-01-02" }}
</time>
</span>
{{- end }}
2022-04-30 07:46:47 +00:00
{{- if ne (.PublishDate.Format "2006-01-02") (.Lastmod.Format "2006-01-02") }}
<span class="post__meta-icon-label">
{{ partial "components/heroicon.html" "arrow-path" }}
<time datetime="{{ .Lastmod.Format $RFC3339 }}" title="{{ i18n "updated_on" }}">
{{ .Lastmod.Format "2006-01-02" }}
</time>
</span>
{{- end }}
2022-04-30 07:46:47 +00:00
{{- /* 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 }}
<span class="post__meta-icon-label" data-authors="{{ jsonify $names }}" title="{{ i18n "published_by" }}">
{{ partial "components/heroicon.html" (dict "id" "pencil") }}
<span>
{{ $author }}{{ if ge (len .) 2 }}, et al.{{ end }}
</span>
2022-04-30 07:46:47 +00:00
</span>
{{- end }}
</div>
{{- end }}