hugo-toha/layouts/partials/helpers/get-author-name.html
Jean-Baptiste Le Duigou 3f59ba883a
Author name should default to site author
If author name is not present in the blog post it should default to site author
2020-06-24 08:24:29 +02:00

12 lines
332 B
HTML

{{ $authorName:= "John Doe"}}
{{ if .Site.Data.site.author}}
{{ $authorName = .Site.Data.site.author.name }}
{{ end}}
{{ if eq (printf "%T" .Params.author ) "maps.Params" }}
{{ with .Params.author }}
{{ if .name }}
{{ $authorName = .name }}
{{ end }}
{{ end }}
{{ end }}
{{ return $authorName }}