page_author_card.html 1.7 KB

12345678910111213141516171819202122232425262728293031
  1. {{ $page := .page }}
  2. {{ $author_urlized := .username }}
  3. {{ $site_type := site.Params.site_type | default "Person" }}
  4. {{ $taxonomy := "authors" }}
  5. {{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_urlized) }}
  6. {{ with $profile_page }}
  7. {{ if isset .Params "superuser" }}{{/* Check an author profile exists. */}}
  8. {{/* If it's a personal site and primary page author is superuser, link to the homepage rather than their profile page. */}}
  9. {{ $profile_url := .RelPermalink }}
  10. {{ if and (eq $site_type "Person") (eq .Params.superuser true) }}
  11. {{ $profile_url = site.BaseURL }}
  12. {{ end }}
  13. {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
  14. {{ $avatar_shape := site.Params.avatar.shape | default "circle" }}
  15. <div class="media author-card content-widget-hr">
  16. {{ if and site.Params.avatar.gravatar .Params.email }}
  17. <img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="https://s.gravatar.com/avatar/{{ md5 .Params.email }}?s=200')" alt="{{.Title}}">
  18. {{ else if $avatar }}
  19. {{ $avatar_image := $avatar.Fill "270x270 Center" }}
  20. <img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $avatar_image.RelPermalink }}" alt="{{.Title}}">
  21. {{ end }}
  22. <div class="media-body">
  23. <h5 class="card-title"><a href="{{$profile_url}}">{{.Title}}</a></h5>
  24. {{ with .Params.role }}<h6 class="card-subtitle">{{. | markdownify | emojify}}</h6>{{end}}
  25. {{ with .Params.bio }}<p class="card-text">{{. | markdownify | emojify}}</p>{{end}}
  26. {{ partial "social_links" . }}
  27. </div>
  28. </div>
  29. {{end}}
  30. {{end}}{{/* Profile page block */}}