about.avatar.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {{ $ := .root }}
  2. {{ $page := .page }}
  3. {{ $author := "" }}
  4. {{ if .author }}
  5. {{ $author = .author }}
  6. {{ else }}
  7. {{ $author = $page.Params.author }}
  8. {{end}}
  9. {{ $person_page_path := (printf "/authors/%s" $author) }}
  10. {{ $person_page := site.GetPage $person_page_path }}
  11. {{ if not $person_page }}
  12. {{ errorf "Could not find an author page at `%s`. Please check the value of `author` in your About widget and create an associated author page if one does not already exist. See https://wowchemy.com/docs/page-builder/#about " $person_page_path }}
  13. {{end}}
  14. {{ $person := $person_page.Params }}
  15. {{ $avatar := ($person_page.Resources.ByType "image").GetMatch "*avatar*" }}
  16. {{ $avatar_shape := site.Params.avatar.shape | default "circle" }}
  17. <div id="profile">
  18. {{ if site.Params.avatar.gravatar }}
  19. <img class="avatar {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="https://s.gravatar.com/avatar/{{ md5 $person.email }}?s=150')" alt="{{$person_page.Title}}">
  20. {{ else if $avatar }}
  21. {{ $avatar_image := $avatar.Fill "150x150 Center" }}
  22. <img class="avatar {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $avatar_image.RelPermalink }}" alt="{{$person_page.Title}}">
  23. {{ end }}
  24. <div class="portrait-title">
  25. <h2>{{ $person_page.Title }}</h2>
  26. {{ with $person.role }}<h3>{{ . | markdownify | emojify }}</h3>{{ end }}
  27. {{ range $person.organizations }}
  28. <h3>
  29. {{ with .url }}<a href="{{ . }}" target="_blank" rel="noopener">{{ end }}
  30. <span>{{ .name }}</span>
  31. {{ if .url }}</a>{{ end }}
  32. </h3>
  33. {{ end }}
  34. </div>
  35. <ul class="network-icon" aria-hidden="true">
  36. {{ range $person.social }}
  37. {{ $pack := or .icon_pack "fas" }}
  38. {{ $pack_prefix := $pack }}
  39. {{ if in (slice "fab" "fas" "far" "fal") $pack }}
  40. {{ $pack_prefix = "fa" }}
  41. {{ end }}
  42. {{ $link := .link }}
  43. {{ $scheme := (urls.Parse $link).Scheme }}
  44. {{ $target := "" }}
  45. {{ if not $scheme }}
  46. {{ $link = .link | relLangURL }}
  47. {{ else if in (slice "http" "https") $scheme }}
  48. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  49. {{ end }}
  50. <li>
  51. <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} aria-label="{{ .icon }}">
  52. <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} big-icon"></i>
  53. </a>
  54. </li>
  55. {{ end }}
  56. </ul>
  57. </div>