about.avatar.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 $avatar }}
  19. <div class="avatar-wrapper">
  20. {{ $avatar_image := $avatar.Fill "150x150 Center" }}
  21. <img class="avatar {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $avatar_image.RelPermalink }}" alt="{{$person_page.Title}}">
  22. {{with $person.status.icon}}<span class="avatar-emoji">{{.|emojify}}</span>{{end}}
  23. </div>
  24. {{ end }}
  25. <div class="portrait-title">
  26. <h2>{{ $person_page.Title }}</h2>
  27. {{ with $person.role }}<h3>{{ . | markdownify | emojify }}</h3>{{ end }}
  28. {{ range $person.organizations }}
  29. <h3>
  30. {{ with .url }}<a href="{{ . }}" target="_blank" rel="noopener">{{ end }}
  31. <span>{{ .name }}</span>
  32. {{ if .url }}</a>{{ end }}
  33. </h3>
  34. {{ end }}
  35. </div>
  36. <ul class="network-icon" aria-hidden="true">
  37. {{ range $person.social }}
  38. {{ $pack := or .icon_pack "fas" }}
  39. {{ $pack_prefix := $pack }}
  40. {{ if in (slice "fab" "fas" "far" "fal") $pack }}
  41. {{ $pack_prefix = "fa" }}
  42. {{ end }}
  43. {{ $link := .link }}
  44. {{ $scheme := (urls.Parse $link).Scheme }}
  45. {{ $target := "" }}
  46. {{ if not $scheme }}
  47. {{ $link = .link | relLangURL }}
  48. {{ else if in (slice "http" "https") $scheme }}
  49. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  50. {{ end }}
  51. <li>
  52. <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} aria-label="{{ .icon }}">
  53. <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} big-icon"></i>
  54. </a>
  55. </li>
  56. {{ end }}
  57. </ul>
  58. </div>