get_author_name.html 754 B

1234567891011121314151617181920212223242526
  1. {{/* Get name of primary author. */}}
  2. {{ $page := . }}
  3. {{/* Get publisher as fall back. */}}
  4. {{ $publisher := site.Params.marketing.seo.org_name | default site.Title }}
  5. {{ $author := "" }}
  6. {{ $author_username := "" }}
  7. {{ if and (not $page.Params.authors) ($page.Scratch.Get "superuser_username") }}
  8. {{ $author_username = $page.Scratch.Get "superuser_username" }}
  9. {{ else if $page.Params.authors }}
  10. {{ $author = index $page.Params.authors 0 }}
  11. {{ $author_username = urlize $author }}
  12. {{ end }}
  13. {{ $taxonomy := "authors" }}
  14. {{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_username) }}
  15. {{ with $profile_page }}
  16. {{ $author = .Title }}
  17. {{ else }}
  18. {{ $author = $author | default $publisher }}
  19. {{ end }}
  20. {{ return $author }}