Files
HugoBlox-kit/layouts/partials/article_metadata.html
T

67 lines
2.1 KiB
HTML

{{ $is_list := .is_list }}
{{ $ := .content }}
<div class="article-metadata">
{{/* If `authors` is set and is not empty. */}}
{{ if $.Params.authors }}
{{ $authorLen := len $.Params.authors }}
<div>
{{ range $k, $v := $.Params.authors }}
<span itemscope itemprop="author" itemtype="http://schema.org/Person">
<span itemprop="name">{{- $v -}}</span>
</span>
{{- if lt $k (sub $authorLen 1) -}}, {{ end }}
{{ end }}
</div>
{{ else }}
<span itemscope itemprop="author" itemtype="http://schema.org/Person">
<meta itemprop="name" content="{{ $.Site.Params.name }}">
</span>
{{ end }}
<span class="article-date">
{{ if ne $.Params.Lastmod $.Params.Date }}
{{ i18n "last_updated" }}
{{ end }}
<meta content="{{ $.Params.Date }}" itemprop="datePublished">
<time datetime="{{ $.Params.LastMod }}" itemprop="dateModified">
{{ $.Lastmod.Format $.Site.Params.date_format }}
</time>
</span>
<span itemscope itemprop="publisher" itemtype="http://schema.org/Person">
<meta itemprop="name" content="{{ $.Site.Params.name }}">
</span>
{{ if ne $.Site.Params.reading_time false }}
<span class="middot-divider"></span>
<span class="article-reading-time">
{{ $.ReadingTime }} {{ i18n "minute_read" }}
</span>
{{ end }}
{{ $comments_enabled := and $.Site.DisqusShortname (not (or $.Site.Params.disable_comments $.Params.disable_comments)) }}
{{ if and $comments_enabled ($.Site.Params.comment_count | default true) }}
<span class="middot-divider"></span>
<a href="{{ $.RelPermalink }}#disqus_thread"><!-- Count will be inserted here --></a>
{{ end}}
{{ if isset $.Params "categories" }}
{{ $categoriesLen := len $.Params.categories }}
{{ if gt $categoriesLen 0 }}
<span class="middot-divider"></span>
<span class="article-categories">
<i class="fas fa-folder"></i>
{{ range $k, $v := $.Params.categories }}
<a href="{{ ($.Site.GetPage (printf "categories/%s" .)).RelPermalink }}">{{ . }}</a>
{{- if lt $k (sub $categoriesLen 1) -}}, {{ end }}
{{ end }}
</span>
{{ end }}
{{ end }}
{{ if ne $is_list 1 }}
{{ partial "share.html" $ }}
{{ end }}
</div>