page_author.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {{ if not (or (eq .Site.Params.profile false) (eq .Params.profile false)) }}
  2. {{ $author := "" }}
  3. {{ if .Params.authors }}
  4. {{ $author = index .Params.authors 0 }}
  5. {{ end }}
  6. {{/* Display site author if page authors not explicitly specified or if first page author is site author. */}}
  7. {{ if or (not .Params.authors) (eq $author $.Site.Params.name) }}
  8. <div class="media author-card" itemscope itemtype="http://schema.org/Person">
  9. {{ if $.Site.Params.gravatar }}
  10. <img class="portrait mr-3" src="https://s.gravatar.com/avatar/{{ md5 $.Site.Params.email }}?s=200')" itemprop="image" alt="Avatar">
  11. {{ else if $.Site.Params.avatar }}
  12. <img class="portrait mr-3" src="{{ (printf "img/%s" $.Site.Params.avatar) | relURL }}" itemprop="image" alt="Avatar">
  13. {{ end }}
  14. <div class="media-body">
  15. <h5 class="card-title" itemprop="name"><a href="{{ "/" | relLangURL }}">{{ $.Site.Params.name }}</a></h5>
  16. {{ with $.Site.Params.role }}<h6 class="card-subtitle">{{.}}</h6>{{end}}
  17. {{ with $.Site.Params.bio }}<p class="card-text" itemprop="description">{{. | markdownify | emojify}}</p>{{end}}
  18. <ul class="network-icon" aria-hidden="true">
  19. {{ range $.Site.Params.social }}
  20. {{ $pack := or .icon_pack "fas" }}
  21. {{ $pack_prefix := $pack }}
  22. {{ if in (slice "fab" "fas" "far" "fal") $pack }}
  23. {{ $pack_prefix = "fa" }}
  24. {{ end }}
  25. {{ $link := .link }}
  26. {{ $scheme := (urls.Parse $link).Scheme }}
  27. {{ $target := "" }}
  28. {{ if not $scheme }}
  29. {{ $link = .link | relLangURL }}
  30. {{ else if in (slice "http" "https") $scheme }}
  31. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  32. {{ end }}
  33. <li>
  34. <a itemprop="sameAs" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>
  35. <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }}"></i>
  36. </a>
  37. </li>
  38. {{ end }}
  39. </ul>
  40. </div>
  41. </div>
  42. {{end}}
  43. {{end}}