page_author_card.html 1.6 KB

1234567891011121314151617181920212223242526272829
  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 it's a personal site and primary page author is superuser, link to the homepage rather than their profile page. */}}
  8. {{ $profile_url := .RelPermalink }}
  9. {{ if and (eq $site_type "Person") (eq .Params.superuser true) }}
  10. {{ $profile_url = site.BaseURL }}
  11. {{ end }}
  12. {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
  13. {{ $avatar_shape := site.Params.avatar.shape | default "circle" }}
  14. <div class="media author-card content-widget-hr">
  15. {{ if and site.Params.avatar.gravatar .Params.email }}
  16. <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="{{.Params.name}}">
  17. {{ else if $avatar }}
  18. {{ $avatar_image := $avatar.Fill "270x270 Center" }}
  19. <img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $avatar_image.RelPermalink }}" alt="{{.Params.name}}">
  20. {{ end }}
  21. <div class="media-body">
  22. <h5 class="card-title"><a href="{{$profile_url}}">{{.Params.name}}</a></h5>
  23. {{ with .Params.role }}<h6 class="card-subtitle">{{. | markdownify | emojify}}</h6>{{end}}
  24. {{ with .Params.bio }}<p class="card-text">{{. | markdownify | emojify}}</p>{{end}}
  25. {{ partial "social_links" . }}
  26. </div>
  27. </div>
  28. {{end}}{{/* Profile page block */}}