12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- {{/* Author profile box */}}
- {{/* Don't show author box on normal pages or if author box disabled. */}}
- {{ if ne .Type "page" | and (not (or (eq site.Params.profile false) (eq .Params.profile false))) }}
- {{/* Display superuser if superuser exists and page authors are not explicitly specified. */}}
- {{/* Otherwise, display first author if a profile for them exists. */}}
- {{ $author_urlized := "" }}
- {{ if and (not .Params.authors) (.Scratch.Get "superuser_username") }}
- {{ $author_urlized = (.Scratch.Get "superuser_username") }}
- {{ else }}
- {{ $first_author := "" }}
- {{ if .Params.authors }}
- {{ $first_author = index .Params.authors 0 }}
- {{ end }}
- {{ $author_urlized = urlize $first_author }}
- {{ end }}
- {{ $site_type := site.Params.site_type | default "Person" }}
- {{ $taxonomy := "authors" }}
- {{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_urlized) }}
- {{ with $profile_page }}
- {{/* 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*" }}
- <div class="media author-card content-widget-hr">
- {{ if and site.Params.gravatar .Params.email }}
- <img class="portrait mr-3" src="https://s.gravatar.com/avatar/{{ md5 .Params.email }}?s=200')" alt="Avatar">
- {{ else if $avatar }}
- {{ $avatar_image := $avatar.Fill "250x250 Center" }}
- <img class="portrait mr-3" src="{{ $avatar_image.RelPermalink }}" alt="Avatar">
- {{ end }}
- <div class="media-body">
- <h5 class="card-title"><a href="{{$profile_url}}">{{.Params.name}}</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}}{{/* Profile page block */}}
- {{end}}{{/* Show profile block */}}
|