page_metadata_authors.html 931 B

1234567891011121314151617181920212223
  1. {{/* If `authors` is set and is not empty. */}}
  2. {{ if $.Params.authors }}
  3. {{ $authorLen := len $.Params.authors }}
  4. {{ if gt $authorLen 0 }}
  5. {{ range $k, $v := $.Params.authors -}}
  6. <span itemscope itemprop="author" itemtype="http://schema.org/Person">
  7. <span itemprop="name">
  8. {{ $link := (site.GetPage (printf "/authors/%s" (urlize $v))).RelPermalink }}
  9. {{ $person_page_path := (printf "/author/%s" (urlize $v)) }}
  10. {{ $person_page := site.GetPage $person_page_path }}
  11. {{ if $person_page }}
  12. {{ $person := $person_page.Params }}
  13. {{- printf "<a href=\"%s\">%s</a>" $link $person.name | safeHTML -}}
  14. {{- else -}}
  15. {{- printf "<a href=\"%s\">%s</a>" $link ($v | markdownify) | safeHTML -}}
  16. {{- end -}}
  17. </span>{{- /* This comment removes whitespace */ -}}
  18. </span>
  19. {{- if lt $k (sub $authorLen 1) -}}, {{ end }}
  20. {{ end }}
  21. {{ end }}
  22. {{ end }}