Files
HugoBlox-kit/layouts/partials/page_author_card.html
T
George Cushen 601620c7a6 feat: make taxonomy URLs singular
- make taxonomy URLs singular, consistent with other Academic pages (workaround Hugo attempting to publish taxonomy URLs with plural names). This requires the breaking change below.
- Fix extra space/lines appearing in the author cards underneath page content as reported at https://spectrum.chat/academic/help/publication-widget-adds-additional-lines-at-bottom-of-the-page~315f77d8-7cc8-44a9-a431-5b64b7556c53

BREAKING CHANGE:
Rename `name` to `title` in author profiles within `author/` folder.
2020-04-15 01:17:56 +01:00

32 lines
1.7 KiB
HTML

{{ $page := .page }}
{{ $author_urlized := .username }}
{{ $site_type := site.Params.site_type | default "Person" }}
{{ $taxonomy := "authors" }}
{{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_urlized) }}
{{ with $profile_page }}
{{ if isset .Params "superuser" }}{{/* Check an author profile exists. */}}
{{/* If it's a personal site and primary page author is superuser, link to the homepage rather than their profile page. */}}
{{ $profile_url := .RelPermalink }}
{{ if and (eq $site_type "Person") (eq .Params.superuser true) }}
{{ $profile_url = site.BaseURL }}
{{ end }}
{{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
{{ $avatar_shape := site.Params.avatar.shape | default "circle" }}
<div class="media author-card content-widget-hr">
{{ if and site.Params.avatar.gravatar .Params.email }}
<img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="https://s.gravatar.com/avatar/{{ md5 .Params.email }}?s=200')" alt="{{.Title}}">
{{ else if $avatar }}
{{ $avatar_image := $avatar.Fill "270x270 Center" }}
<img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $avatar_image.RelPermalink }}" alt="{{.Title}}">
{{ end }}
<div class="media-body">
<h5 class="card-title"><a href="{{$profile_url}}">{{.Title}}</a></h5>
{{ with .Params.role }}<h6 class="card-subtitle">{{. | markdownify | emojify}}</h6>{{end}}
{{ with .Params.bio }}<p class="card-text">{{. | markdownify | emojify}}</p>{{end}}
{{ partial "social_links" . }}
</div>
</div>
{{end}}
{{end}}{{/* Profile page block */}}