people.html 2.2 KB

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