hugo-geekblog/layouts/partials/metadata.html

84 lines
2.7 KiB
HTML
Raw Normal View History

<span class="flex align-center no-wrap gblog-post__meta--update">
<svg class="gblog-icon gblog_date"><use xlink:href="#gblog_date"></use></svg>
<span class="gblog-post__tag">
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
{{ if .Lastmod.After (.Date.AddDate 0 0 1) }}
Updated on
{{ end }}
{{ .Lastmod.Format "Jan 2, 2006" }}
</time>
</span>
</span>
<span class="flex align-center no-wrap gblog-post__meta--readtime">
<svg class="gblog-icon gblog_timer"><use xlink:href="#gblog_timer"></use></svg>
<span class="gblog-post__tag">{{ .ReadingTime }} min read</span>
</span>
{{ if eq .Params.weight 1 }}
<span class="flex align-center no-wrap gblog-post__meta--pinned">
<svg class="gblog-icon gblog_pin"><use xlink:href="#gblog_pin"></use></svg>
<span class="gblog-post__tag">Pinned</span>
</span>
{{ end }}
{{ $ac := 0 }}
{{ with .Params.authors }}
{{ range sort . }}
{{ $author := index $.Site.Data.authors . }}
{{ with $.Site.GetPage (printf "/authors/%s" . | urlize) }}
{{ if eq $ac 0 }}
<span class="flex align-center no-wrap gblog-post__meta--author">
<svg class="gblog-icon gblog_person"><use xlink:href="#gblog_person"></use></svg>
{{ template "post-author" dict "name" $author.name "page" . }}
</span>
{{ else }}
<span class="flex align-center gblog-post__meta--author">
{{ template "post-author" dict "name" $author.name "page" . }}
</span>
{{ end }}
{{ end }}
{{ $ac = (add $ac 1) }}
{{ end }}
{{ end }}
{{ $tc := 0 }}
{{ with .Params.tags }}
{{ range sort . }}
{{ $name := . }}
{{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }}
{{ if eq $tc 0 }}
<span class="flex align-center no-wrap gblog-post__meta--tag">
<svg class="gblog-icon gblog_bookmark"><use xlink:href="#gblog_bookmark"></use></svg>
{{ template "post-tag" dict "name" $name "page" . }}
</span>
{{ else }}
<span class="flex align-center gblog-post__meta--tag">
{{ template "post-tag" dict "name" $name "page" . }}
</span>
{{ end }}
{{ end }}
{{ $tc = (add $tc 1) }}
{{ end }}
{{ end }}
{{ define "post-tag" }}
<span class="gblog-post__tag gblog-button gblog-button--regular">
<a
class="gblog-button__link"
href="{{ .page.RelPermalink }}"
title="All posts tagged with '{{ .name }}'"
>
2022-01-08 12:45:19 +00:00
{{ .name }}
</a>
</span>
{{ end }}
{{ define "post-author" }}
<span class="gblog-post__tag gblog-button gblog-button--regular">
2022-01-08 12:45:19 +00:00
<a class="gblog-button__link" href="{{ .page.RelPermalink }}" title="All posts of this author">
{{ .name }}
</a>
</span>
{{ end }}