page_author_card.html 1.9 KB

123456789101112131415161718192021222324252627282930
  1. {{ $page := .page }}
  2. {{ $author_page := .author_page }}
  3. {{ $site_type := site.Params.marketing.seo.site_type | default "Person" }}
  4. {{- $has_profile := not (eq nil $author_page.Params.superuser) -}}
  5. {{/* Check an author profile exists. */}}
  6. {{ if $has_profile }}
  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 := $author_page.RelPermalink }}
  9. {{ if and (eq $site_type "Person") (eq $author_page.Params.superuser true) }}
  10. {{ $profile_url = site.BaseURL }}
  11. {{ end }}
  12. {{ $avatar := ($author_page.Resources.ByType "image").GetMatch "*avatar*" }}
  13. {{ $avatar_shape := site.Params.features.avatar.shape | default "circle" }}
  14. <div class="media author-card content-widget-hr">
  15. {{ if and site.Params.features.avatar.gravatar $author_page.Params.email }}
  16. {{if $profile_url}}<a href="{{$profile_url}}">{{end}}<img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="https://s.gravatar.com/avatar/{{ md5 $author_page.Params.email }}?s=200" alt="{{$author_page.Title}}">{{if $profile_url}}</a>{{end}}
  17. {{ else if $avatar }}
  18. {{ $avatar_image := $avatar.Fill "270x270 Center" }}
  19. {{if $profile_url}}<a href="{{$profile_url}}">{{end}}<img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $avatar_image.RelPermalink }}" alt="{{$author_page.Title}}">{{if $profile_url}}</a>{{end}}
  20. {{ end }}
  21. <div class="media-body">
  22. <h5 class="card-title">{{if $profile_url}}<a href="{{$profile_url}}">{{end}}{{$author_page.Title}}{{if $profile_url}}</a>{{end}}</h5>
  23. {{ with $author_page.Params.role }}<h6 class="card-subtitle">{{. | markdownify | emojify}}</h6>{{end}}
  24. {{ with $author_page.Params.bio }}<p class="card-text">{{. | markdownify | emojify}}</p>{{end}}
  25. {{ partial "social_links" $author_page }}
  26. </div>
  27. </div>
  28. {{end}}{{/* Profile page block */}}