12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- {{/* People Widget */}}
- {{/* Initialise */}}
- {{ $ := .root }}
- {{ $page := .page }}
- {{ $show_social := $page.Params.design.show_social | default false }}
- {{ $show_interests := $page.Params.design.show_interests | default true }}
- {{ $show_organizations := $page.Params.design.show_organizations | default false }}
- {{ $show_role := $page.Params.design.show_role | default true }}
- <div class="row justify-content-center people-widget">
- {{ with $page.Title }}
- <div class="col-md-12 section-heading">
- <h1>{{ . | markdownify | emojify }}</h1>
- {{ if $page.Params.subtitle }}<p>{{ $page.Params.subtitle | markdownify | emojify }}</p>{{ end }}
- </div>
- {{ end }}
- {{ with $page.Content }}
- <div class="col-md-12">
- {{ . }}
- </div>
- {{ end }}
- {{ range $page.Params.content.user_groups }}
- {{ $query := where (where site.Pages "Section" "authors") ".Params.user_groups" "intersect" (slice .) }}
- {{if $query | and (gt (len $page.Params.content.user_groups) 1) }}
- <div class="col-md-12">
- <h2 class="mb-4">{{ . | markdownify }}</h2>
- </div>
- {{end}}
- {{ range $query }}
- {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
- {{/* Get link to user's profile page. */}}
- {{ $link := "" }}
- {{ with site.GetPage (printf "/authors/%s" (path.Base (path.Split .Path).Dir)) }}
- {{ $link = .RelPermalink }}
- {{ end }}
- <div class="col-12 col-sm-auto people-person">
- {{ $src := "" }}
- {{ if site.Params.features.avatar.gravatar }}
- {{ $src = printf "https://s.gravatar.com/avatar/%s?s=150" (md5 .Params.email) }}
- {{ else if $avatar }}
- {{ $avatar_image := $avatar.Fill "270x270 Center" }}
- {{ $src = $avatar_image.RelPermalink }}
- {{ end }}
- {{ if $src }}
- {{ $avatar_shape := site.Params.features.avatar.shape | default "circle" }}
- {{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}}
- {{ end }}
- <div class="portrait-title">
- <h2>{{with $link}}<a href="{{.}}">{{end}}{{ .Title }}{{if $link}}</a>{{end}}</h2>
- {{ if and $show_organizations .Params.organizations }}{{ range .Params.organizations }}<h3>{{ .name }}</h3>{{ end }}{{ end }}
- {{ if and $show_role .Params.role }}<h3>{{ .Params.role | markdownify | emojify }}</h3>{{ end }}
- {{ if $show_social }}{{ partial "social_links" . }}{{ end }}
- {{ if and $show_interests .Params.interests }}<p class="people-interests">{{ delimit .Params.interests ", " | markdownify | emojify }}</p>{{ end }}
- </div>
- </div>
- {{ end }}
- {{ end }}
- </div>
|