Files
Custom-Static-Website-Gener…/Future-Features/sample-hugo-template/Tech-Club-Blog/layouts/partials/func/GetArticleAuthors.html
2020-05-14 12:10:15 +04:00

39 lines
1000 B
HTML

{{/*
GetArticle Authors
Retrieve the authors assigned to a given article
@author @regisphilibert
@context Page (.) The article in quest
@access public
@return Slice
- String (.name)
- String (.URL)
- String (.name)
- String (.firstname)
@example - Go Template
{{ $authors := partialCached "func/GetArticleAuthors" . .File.UniqueID }}
*/}}
{{ $authors := slice }}
{{ with .Params.authors }}
{{ range $name := . }}
{{ with site.GetPage (printf "/%s/%s" "authors" ($name | urlize)) }}
{{ $firstname := "" }}
{{ $name := "" }}
{{ $avatar := false }}
{{ with .Title }}
{{ $name = . }}
{{ $firstname = index (split . " ") 0 }}
{{ end }}
{{ with .Params.avatar }}
{{ $avatar = . }}
{{ end }}
{{ $authors = $authors | append (dict "URL" .RelPermalink "name" $name "firstname" $firstname "avatar" $avatar) }}
{{ end }}
{{ end }}
{{ end }}
{{ return $authors }}