about.avatar.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.features.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>
  27. {{- if $person.name_pronunciation -}}
  28. <ruby>
  29. <rb>{{ $person_page.Title }}</rb>
  30. <rt>{{ $person.name_pronunciation }}</rt>
  31. </ruby>
  32. {{- else -}}
  33. {{- $person_page.Title -}}
  34. {{- end -}}
  35. </h2>
  36. {{ with $person.role }}<h3>{{ . | markdownify | emojify }}</h3>{{ end }}
  37. {{ range $person.organizations }}
  38. <h3>
  39. {{ with .url }}<a href="{{ . }}" target="_blank" rel="noopener">{{ end }}
  40. <span>{{ .name }}</span>
  41. {{ if .url }}</a>{{ end }}
  42. </h3>
  43. {{ end }}
  44. </div>
  45. <ul class="network-icon" aria-hidden="true">
  46. {{ range $person.social }}
  47. {{ $pack := or .icon_pack "fas" }}
  48. {{ $pack_prefix := $pack }}
  49. {{ if in (slice "fab" "fas" "far" "fal") $pack }}
  50. {{ $pack_prefix = "fa" }}
  51. {{ end }}
  52. {{ $link := .link }}
  53. {{ $scheme := (urls.Parse $link).Scheme }}
  54. {{ $target := "" }}
  55. {{ if not $scheme }}
  56. {{ $link = .link | relLangURL }}
  57. {{ else if in (slice "http" "https") $scheme }}
  58. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  59. {{ end }}
  60. <li>
  61. <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} aria-label="{{ .icon }}">
  62. <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} big-icon"></i>
  63. </a>
  64. </li>
  65. {{ end }}
  66. </ul>
  67. {{ with $page.Content }}
  68. <div class="article-style pt-1">
  69. {{ . }}
  70. </div>
  71. {{ end }}
  72. </div>