Fix metadata for case of multiple authors (#606)

This commit is contained in:
Prateek Kumar authored and gcushen committed 2018-07-29 11:22:21 +01:00
1 parent 54dac71022
commit 3c6bd89a1e
1 file changed
+13 -6
+13 -6
View File
@@ -2,14 +2,21 @@
{{ $ := .content }}
<div class="article-metadata">
{{/* If `authors` is set and is not empty. */}}
{{ if $.Params.authors }}
{{ $authorLen := len $.Params.authors }}
<div itemprop="author">
<div>
{{ range $k, $v := $.Params.authors }}
{{- $v -}}
{{- if lt $k (sub $authorLen 1) -}}, {{ end }}
<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">
@@ -21,7 +28,7 @@
{{ $.Lastmod.Format $.Site.Params.date_format }}
</time>
</span>
<span itemscope itemprop="author publisher" itemtype="http://schema.org/Person">
<span itemscope itemprop="publisher" itemtype="http://schema.org/Person">
<meta itemprop="name" content="{{ $.Site.Params.name }}">
</span>
@@ -45,8 +52,8 @@
<span class="article-categories">
<i class="fa fa-folder"></i>
{{ range $k, $v := $.Params.categories }}
<a href="{{ ($.Site.GetPage (printf "categories/%s" .)).Permalink }}">{{ . }}</a
>{{ if lt $k (sub $categoriesLen 1) }}, {{ end }}
<a href="{{ ($.Site.GetPage (printf "categories/%s" .)).Permalink }}">{{ . }}</a>
{{- if lt $k (sub $categoriesLen 1) -}}, {{ end }}
{{ end }}
</span>
{{ end }}