~nykma/hugo-theme-jane unlisted

4045a54782c703d56f1574def89f6456b428139d — Nyk Ma a month ago 7fa1a5f
[!] Iterate author in post params

ox-hugo export author as String[]
2 files changed, 8 insertions(+), 4 deletions(-)

M layouts/partials/head.html
M layouts/partials/post/copyright.html
M layouts/partials/head.html => layouts/partials/head.html +4 -2
@@ 24,12 24,14 @@

<!-- author & description & keywords  -->
{{- if or .Params.author .Site.Author.name -}}
{{- $author_id := .Params.author | default .Site.Author.name -}}
{{- range $author_single := $.Params.author -}}
{{- $author_id := $author_single | default $.Site.Author.name -}}
{{- $author := (index ($.Site.Data.authors | default dict) $author_id) -}}
{{- $author_lang := (index ($author | default dict) .Site.Language.Lang) -}}
{{- $author_lang := (index ($author | default dict) $.Site.Language.Lang) -}}
{{- $author_name := $author_lang.name.display | default $author.name.display | default $author_id -}}
<meta name="author" content="{{ $author_name | safeHTML }}" />
{{- end -}}
{{- end -}}

{{- if .Description -}}
  <meta name="description" content="{{ .Description | safeHTML }}" />

M layouts/partials/post/copyright.html => layouts/partials/post/copyright.html +4 -2
@@ 3,15 3,17 @@
  <p class="copyright-item">
    <span class="item-title">{{ i18n "author" }}</span>
    <span class="item-content">
      {{- $author_id := .Params.author | default .Site.Author.name -}}
      {{- range $author_single := $.Params.author -}}
      {{- $author_id := $author_single | default $.Site.Author.name -}}
      {{- $author := (index ($.Site.Data.authors | default dict) $author_id) -}}
      {{- $author_lang := (index ($author | default dict) .Site.Language.Lang) -}}
      {{- $author_lang := (index ($author | default dict) $.Site.Language.Lang) -}}
      {{- $author_name := $author_lang.name.display | default $author.name.display | default $author_id -}}
      {{- with $.Site.GetPage "taxonomy" (printf "author/%s" $author_id) -}}
      <a href="{{ .Permalink }}">{{ $author_name | safeHTML }}</a>
      {{- else -}}
      {{- $author_name | safeHTML -}}
      {{- end -}}
      {{- end -}}
      </span>
  </p>
  <p class="copyright-item">