people.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {{/* People Widget */}}
  2. {{/* Initialise */}}
  3. {{ $ := .root }}
  4. {{ $page := .page }}
  5. {{ $show_social := $page.Params.design.show_social | default false }}
  6. {{ $show_interests := $page.Params.design.show_interests | default true }}
  7. {{ $show_organizations := $page.Params.design.show_organizations | default false }}
  8. <div class="row justify-content-center people-widget">
  9. {{ with $page.Title }}
  10. <div class="col-md-12 section-heading">
  11. <h1>{{ . | markdownify | emojify }}</h1>
  12. {{ if $page.Params.subtitle }}<p>{{ $page.Params.subtitle | markdownify | emojify }}</p>{{ end }}
  13. </div>
  14. {{ end }}
  15. {{ with $page.Content }}
  16. <div class="col-md-12">
  17. {{ . }}
  18. </div>
  19. {{ end }}
  20. {{ range $page.Params.content.user_groups }}
  21. {{ $query := where (where site.Pages "Section" "authors") ".Params.user_groups" "intersect" (slice .) }}
  22. {{if $query}}
  23. <div class="col-md-12">
  24. <h2 class="mb-4">{{ . | markdownify }}</h2>
  25. </div>
  26. {{end}}
  27. {{ range $query }}
  28. {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
  29. {{/* Get link to user's profile page. */}}
  30. {{ $link := "" }}
  31. {{ with site.GetPage (printf "/authors/%s" (path.Base (path.Split .Path).Dir)) }}
  32. {{ $link = .RelPermalink }}
  33. {{ end }}
  34. <div class="col-12 col-sm-auto people-person">
  35. {{ $src := "" }}
  36. {{ if site.Params.avatar.gravatar }}
  37. {{ $src = printf "https://s.gravatar.com/avatar/%s?s=150" (md5 .Params.email) }}
  38. {{ else if $avatar }}
  39. {{ $avatar_image := $avatar.Fill "270x270 Center" }}
  40. {{ $src = $avatar_image.RelPermalink }}
  41. {{ end }}
  42. {{ if $src }}
  43. {{ $avatar_shape := site.Params.avatar.shape | default "circle" }}
  44. {{with $link}}<a href="{{.}}">{{end}}<img class="avatar {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $src }}" alt="Avatar">{{if $link}}</a>{{end}}
  45. {{ end }}
  46. <div class="portrait-title">
  47. <h2>{{with $link}}<a href="{{.}}">{{end}}{{ .Title }}{{if $link}}</a>{{end}}</h2>
  48. {{ if and $show_organizations .Params.organizations }}{{ range .Params.organizations }}<h3>{{ .name }}</h3>{{ end }}{{ end }}
  49. {{ with .Params.role }}<h3>{{ . | markdownify | emojify }}</h3>{{ end }}
  50. {{ if $show_social }}{{ partial "social_links" . }}{{ end }}
  51. {{ if and $show_interests .Params.interests }}<p class="people-interests">{{ delimit .Params.interests ", " | markdownify | emojify }}</p>{{ end }}
  52. </div>
  53. </div>
  54. {{ end }}
  55. {{ end }}
  56. </div>