people.html 2.6 KB

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