7
1
mirror of https://gitlab.com/ansol/web-ansol.org.git synced 2024-11-25 15:43:17 +00:00
web-ansol.org/themes/academic/layouts/partials/widgets/people.html
2020-06-11 12:46:16 +01:00

62 lines
2.2 KiB
HTML

{{/* People Widget */}}
{{/* Initialise */}}
{{ $ := .root }}
{{ $page := .page }}
{{ $show_social := $page.Params.design.show_social | default false }}
{{ $show_interests := $page.Params.design.show_interests | 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}}
<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.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.avatar.shape | default "circle" }}
{{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}}
{{ end }}
<div class="portrait-title">
<h2>{{with $link}}<a href="{{.}}">{{end}}{{ .Title }}{{if $link}}</a>{{end}}</h2>
{{ with .Params.role }}<h3>{{ . | 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>