aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/author-picture.html
blob: b03f673a6a7d99e81d2bed4deef8c3a48b779e07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{{- $author := partial "function-authors-data.html" . -}}
{{- $profile := $author.picture.profile -}}
{{- $file := not (urls.Parse $profile).Host -}}

{{- if $file -}}
  {{- $profile = print $author.user "/" $profile -}}
{{- end -}}

{{- $image := partial "function-caches-images.html"
  (dict
    "Source"        $profile
    "Fit"           "160x160"
    "Target"        (print (partial "function-paths.html" "media") "/" $author.user "/")
    "Copy"          (print (partial "function-paths.html" "media") "/" $author.user "/" (path.Base $profile))
    "AlternateCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.BaseName $profile) ".webp")
  )
-}}

{{- $width := $image.Width -}}
{{- $height := $image.Height -}}
{{- $source := $image.RelPermalink -}}
{{- $alternate := $author.name -}}
{{- $sourceset := $image.AltRelPermalink -}}

{{- with .Params.feed.image -}}
  {{- $width = "64" -}}
  {{- $height = "64" -}}
  {{- $source = $.Params.feed.image -}}
  {{- $alternate = $.Params.feed.name -}}
  {{- $sourceset = "" -}}
{{- end -}}

{{- with $sourceset -}}
<source srcset="{{ $sourceset }}" type="image/webp" />
{{- end -}}

<img
  width="{{ $width }}"
  height="{{ $height }}"
  src="{{ $source }}"
  alt="{{ $alternate }}"
/>
{{- /* This comment removes trailing newlines and white spaces. */ -}}