1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- {{ 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 := "" }}
- {{ if and (not .Params.authors) (.Scratch.Get "superuser_username") }}
- {{ $author_urlize = (.Scratch.Get "superuser_username") }}
- {{ else }}
- {{ $first_author := "" }}
- {{ if .Params.authors }}
- {{ $first_author = index .Params.authors 0 }}
- {{ end }}
- {{ $author_urlize = 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 }}
- <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>
- </div>
- {{end}}
- {{end}}
|