blog/themes/hugo-blog-awesome/layouts/partials/bio.html

25 lines
1,010 B
HTML

{{ $avatar_img := .Site.Params.author.avatar }}
{{ $avatar_img_alt := .Site.Params.author.name }}
{{ $image := resources.Get $avatar_img }}
<div class="author">
{{ with $image }}
{{ if eq .MediaType.SubType "svg" }}
<svg width="25em" height="25em" xmlns="http://www.w3.org/2000/svg">
<image width="25em" height="25em" href="{{ $image.RelPermalink }}" />
</svg>
{{ else }}
{{ $image1x := $image.Fill "70x70 center webp" }}
{{ $image2x := $image.Fill "140x140 center webp" }}
{{ $image3x := $image.Fill "210x210 center webp" }}
<img
class="author-avatar"
src="{{ $image1x.RelPermalink }}"
srcset="{{ $image2x.RelPermalink }} 2x, {{ $image3x.RelPermalink }} 3x"
alt="{{ $avatar_img_alt }}"
width="{{ $image1x.Width }}"
height="{{ $image1x.Height }}" />
{{ end }}
{{ end }}
<h2 class="author-name">{{ .Site.Params.author.intro }}</h2>
<p class="author-bio">{{ .Site.Params.author.description }}</p>
</div>