get-author-name.html 612 B

1234567891011121314151617
  1. {{/* Uses the top level site's config for a single author across all locales */}}
  2. {{ $authorName:= site.Params.author.name }}
  3. {{/* Overrides with the locale specific author if provided */}}
  4. {{ if (index site.Data site.Language.Lang).author }}
  5. {{ $authorName = (index site.Data site.Language.Lang).author.name }}
  6. {{ end }}
  7. {{/* Lastly, overrides with the post specific author if provided */}}
  8. {{ if eq (printf "%T" .Params.author ) "maps.Params" }}
  9. {{ with .Params.author }}
  10. {{ if .name }}
  11. {{ $authorName = .name }}
  12. {{ end }}
  13. {{ end }}
  14. {{ end }}
  15. {{ return $authorName }}