people.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. <div class="col-md-12">
  21. <h2 class="mb-4">{{ . | markdownify }}</h2>
  22. </div>
  23. {{ $query := where (where site.Pages "Section" "authors") ".Params.content.user_groups" "intersect" (slice .) }}
  24. {{ range $query }}
  25. {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
  26. {{/* Get link to user's profile page. */}}
  27. {{ $link := "" }}
  28. {{ with site.GetPage (printf "/authors/%s" (path.Base (path.Split .Path).Dir)) }}
  29. {{ $link = .RelPermalink }}
  30. {{ end }}
  31. <div class="col-12 col-sm-auto people-person">
  32. {{ $src := "" }}
  33. {{ if site.Params.gravatar }}
  34. {{ $src = printf "https://s.gravatar.com/avatar/%s?s=200" (md5 .Params.email) }}
  35. {{ else if $avatar }}
  36. {{ $avatar_image := $avatar.Fill "150x150 Center" }}
  37. {{ $src = $avatar_image.RelPermalink }}
  38. {{ end }}
  39. {{ if $src }}
  40. {{with $link}}<a href="{{.}}">{{end}}<img class="portrait" src="{{ $src }}" alt="Avatar">{{if $link}}</a>{{end}}
  41. {{ end }}
  42. <div class="portrait-title">
  43. <h2>{{with $link}}<a href="{{.}}">{{end}}{{ .Params.name }}{{if $link}}</a>{{end}}</h2>
  44. {{ with .Params.role }}<h3>{{ . | markdownify | emojify }}</h3>{{ end }}
  45. {{ if $show_social }}{{ partial "social_links" . }}{{ end }}
  46. {{ if and $show_interests .Params.interests }}<p class="people-interests">{{ delimit . ", " | markdownify | emojify }}</p>{{ end }}
  47. {{ end }}
  48. </div>
  49. </div>
  50. {{ end }}
  51. </div>