about.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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" (urlize $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://sourcethemes.com/academic/docs/page-builder/#about " $person_page_path }}
  13. {{end}}
  14. {{ $person := $person_page.Params }}
  15. {{ $avatar := ($person_page.Resources.ByType "image").GetMatch "*avatar*" }}
  16. <!-- About widget -->
  17. <div class="row">
  18. <div class="col-12 col-lg-4">
  19. <div id="profile">
  20. {{ if site.Params.gravatar }}
  21. <img class="portrait" src="https://s.gravatar.com/avatar/{{ md5 $person.email }}?s=200')" alt="Avatar">
  22. {{ else if $avatar }}
  23. {{ $avatar_image := $avatar.Fill "250x250 Center" }}
  24. <img class="portrait" src="{{ $avatar_image.RelPermalink }}" alt="Avatar">
  25. {{ end }}
  26. <div class="portrait-title">
  27. <h2>{{ $person.name }}</h2>
  28. {{ with $person.role }}<h3>{{ . | markdownify | emojify }}</h3>{{ end }}
  29. {{ range $person.organizations }}
  30. <h3>
  31. {{ with .url }}<a href="{{ . }}" target="_blank" rel="noopener">{{ end }}
  32. <span>{{ .name }}</span>
  33. {{ if .url }}</a>{{ end }}
  34. </h3>
  35. {{ end }}
  36. </div>
  37. <ul class="network-icon" aria-hidden="true">
  38. {{ range $person.social }}
  39. {{ $pack := or .icon_pack "fas" }}
  40. {{ $pack_prefix := $pack }}
  41. {{ if in (slice "fab" "fas" "far" "fal") $pack }}
  42. {{ $pack_prefix = "fa" }}
  43. {{ end }}
  44. {{ $link := .link }}
  45. {{ $scheme := (urls.Parse $link).Scheme }}
  46. {{ $target := "" }}
  47. {{ if not $scheme }}
  48. {{ $link = .link | relLangURL }}
  49. {{ else if in (slice "http" "https") $scheme }}
  50. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  51. {{ end }}
  52. <li>
  53. <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>
  54. <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} big-icon"></i>
  55. </a>
  56. </li>
  57. {{ end }}
  58. </ul>
  59. </div>
  60. </div>
  61. <div class="col-12 col-lg-8">
  62. {{/* Only display widget title in explicit instances of about widget, not in author pages. */}}
  63. {{ if and $page.Params.widget $page.Title }}<h1>{{ $page.Title | markdownify | emojify }}</h1>{{ end }}
  64. {{ $person_page.Content }}
  65. <div class="row">
  66. {{ with $person.interests }}
  67. <div class="col-md-5">
  68. <h3>{{ i18n "interests" | markdownify }}</h3>
  69. <ul class="ul-interests">
  70. {{ range . }}
  71. <li>{{ . | markdownify | emojify }}</li>
  72. {{ end }}
  73. </ul>
  74. </div>
  75. {{ end }}
  76. {{ with $person.education }}
  77. <div class="col-md-7">
  78. <h3>{{ i18n "education" | markdownify }}</h3>
  79. <ul class="ul-edu fa-ul">
  80. {{ range .courses }}
  81. <li>
  82. <i class="fa-li fas fa-graduation-cap"></i>
  83. <div class="description">
  84. <p class="course">{{ .course }}{{ with .year }}, {{ . }}{{ end }}</p>
  85. <p class="institution">{{ .institution }}</p>
  86. </div>
  87. </li>
  88. {{ end }}
  89. </ul>
  90. </div>
  91. {{ end }}
  92. </div>
  93. </div>
  94. </div>