|
@@ -1,59 +1,60 @@
|
|
|
+{{/* Author profile box */}}
|
|
|
+
|
|
|
{{ if 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_urlize := "" }}
|
|
|
+{{ $author_urlized := "" }}
|
|
|
{{ if and (not .Params.authors) (.Scratch.Get "superuser_username") }}
|
|
|
- {{ $author_urlize = (.Scratch.Get "superuser_username") }}
|
|
|
+ {{ $author_urlized = (.Scratch.Get "superuser_username") }}
|
|
|
{{ else }}
|
|
|
{{ $first_author := "" }}
|
|
|
{{ if .Params.authors }}
|
|
|
{{ $first_author = index .Params.authors 0 }}
|
|
|
{{ end }}
|
|
|
- {{ $author_urlize = urlize $first_author }}
|
|
|
+ {{ $author_urlized = urlize $first_author }}
|
|
|
{{ end }}
|
|
|
|
|
|
-{{ $person_page_path := (printf "/author/%s" $author_urlize) }}
|
|
|
-{{ $person_page := site.GetPage $person_page_path }}
|
|
|
-{{ with $person_page }}
|
|
|
-{{ $link := printf "/authors/%s" $author_urlize | relURL }}
|
|
|
-{{ $avatar := ($person_page.Resources.ByType "image").GetMatch "*avatar*" }}
|
|
|
-<div class="media author-card" itemscope itemtype="http://schema.org/Person">
|
|
|
- {{ if and site.Params.gravatar .Params.email }}
|
|
|
- <img class="portrait mr-3" src="https://s.gravatar.com/avatar/{{ md5 .Params.email }}?s=200')" itemprop="image" alt="Avatar">
|
|
|
- {{ else if $avatar }}
|
|
|
- {{ $avatar_image := $avatar.Fill "250x250 Center" }}
|
|
|
- <img class="portrait mr-3" src="{{ $avatar_image.RelPermalink }}" itemprop="image" alt="Avatar">
|
|
|
- {{ end }}
|
|
|
+{{ $taxonomy := "authors" }}
|
|
|
+{{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_urlized) }}
|
|
|
+{{ with $profile_page }}
|
|
|
+ {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
|
|
|
+ <div class="media author-card" itemscope itemtype="http://schema.org/Person">
|
|
|
+ {{ if and site.Params.gravatar .Params.email }}
|
|
|
+ <img class="portrait mr-3" src="https://s.gravatar.com/avatar/{{ md5 .Params.email }}?s=200')" itemprop="image" alt="Avatar">
|
|
|
+ {{ else if $avatar }}
|
|
|
+ {{ $avatar_image := $avatar.Fill "250x250 Center" }}
|
|
|
+ <img class="portrait mr-3" src="{{ $avatar_image.RelPermalink }}" itemprop="image" alt="Avatar">
|
|
|
+ {{ end }}
|
|
|
|
|
|
- <div class="media-body">
|
|
|
- <h5 class="card-title" itemprop="name"><a href="{{ $link }}">{{ .Params.name }}</a></h5>
|
|
|
- {{ with .Params.role }}<h6 class="card-subtitle">{{.}}</h6>{{end}}
|
|
|
- {{ with .Params.bio }}<p class="card-text" itemprop="description">{{. | markdownify | emojify}}</p>{{end}}
|
|
|
- <ul class="network-icon" aria-hidden="true">
|
|
|
- {{ range .Params.social }}
|
|
|
- {{ $pack := or .icon_pack "fas" }}
|
|
|
- {{ $pack_prefix := $pack }}
|
|
|
- {{ if in (slice "fab" "fas" "far" "fal") $pack }}
|
|
|
- {{ $pack_prefix = "fa" }}
|
|
|
- {{ end }}
|
|
|
- {{ $link := .link }}
|
|
|
- {{ $scheme := (urls.Parse $link).Scheme }}
|
|
|
- {{ $target := "" }}
|
|
|
- {{ if not $scheme }}
|
|
|
- {{ $link = .link | relLangURL }}
|
|
|
- {{ else if in (slice "http" "https") $scheme }}
|
|
|
- {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
|
|
- {{ end }}
|
|
|
- <li>
|
|
|
- <a itemprop="sameAs" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>
|
|
|
- <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }}"></i>
|
|
|
- </a>
|
|
|
- </li>
|
|
|
- {{ end }}
|
|
|
- </ul>
|
|
|
+ <div class="media-body">
|
|
|
+ <h5 class="card-title" itemprop="name"><a href="{{.RelPermalink}}">{{.Params.name}}</a></h5>
|
|
|
+ {{ with .Params.role }}<h6 class="card-subtitle">{{. | markdownify | emojify}}</h6>{{end}}
|
|
|
+ {{ with .Params.bio }}<p class="card-text" itemprop="description">{{. | markdownify | emojify}}</p>{{end}}
|
|
|
+ <ul class="network-icon" aria-hidden="true">
|
|
|
+ {{ range .Params.social }}
|
|
|
+ {{ $pack := or .icon_pack "fas" }}
|
|
|
+ {{ $pack_prefix := $pack }}
|
|
|
+ {{ if in (slice "fab" "fas" "far" "fal") $pack }}
|
|
|
+ {{ $pack_prefix = "fa" }}
|
|
|
+ {{ end }}
|
|
|
+ {{ $link := .link }}
|
|
|
+ {{ $scheme := (urls.Parse $link).Scheme }}
|
|
|
+ {{ $target := "" }}
|
|
|
+ {{ if not $scheme }}
|
|
|
+ {{ $link = .link | relLangURL }}
|
|
|
+ {{ else if in (slice "http" "https") $scheme }}
|
|
|
+ {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
|
|
+ {{ end }}
|
|
|
+ <li>
|
|
|
+ <a itemprop="sameAs" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>
|
|
|
+ <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }}"></i>
|
|
|
+ </a>
|
|
|
+ </li>
|
|
|
+ {{end}}
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
-</div>
|
|
|
-{{end}}
|
|
|
-{{end}}
|
|
|
+{{end}}{{/* Profile page block */}}
|
|
|
+{{end}}{{/* Show profile block */}}
|