aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/author-card.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/layouts/partials/author-card.html')
-rw-r--r--themes/default/layouts/partials/author-card.html74
1 files changed, 44 insertions, 30 deletions
diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html
index 7c88dfb..953f833 100644
--- a/themes/default/layouts/partials/author-card.html
+++ b/themes/default/layouts/partials/author-card.html
@@ -1,42 +1,56 @@
-{{- $path := print "public/" .Data.user "/media/profile/picture.png" -}}
-{{- $image := resources.Get $path -}}
-{{- $dimensions := "96x96" -}}
-{{- $404image := resources.Get "data/media/404.png" -}}
+{{- $profile := .Data.picture.profile -}}
+
+{{- $image := partial "function-caches-images.html"
+ (dict
+ "Source" (print .Data.user "/" $profile)
+ "Fit" "160x160"
+ "Target" (print (partial "function-paths.html" "media") "/" .Data.user "/")
+ "Copy" (print (partial "function-paths.html" "media") "/" .Data.user "/" (path.Base $profile))
+ "OptimizedCopy" (print (partial "function-paths.html" "media") "/" .Data.user "/" (path.BaseName $profile) ".webp")
+ )
+-}}
+
+{{- $width := $image.Width -}}
+{{- $height := $image.Height -}}
+{{- $source := $image.RelPermalink -}}
+{{- $alternate := .Data.name -}}
+{{- $sourceset := $image.OptRelPermalink -}}
+
+{{- with .Params.feed.image -}}
+ {{- $width = "64" -}}
+ {{- $height = "64" -}}
+ {{- $source = $.Params.feed.image -}}
+ {{- $alternate = $.Params.feed.name -}}
+{{- end -}}
<micro-author>
<micro-card>
<micro-summary>
- <micro-thumbnail>
- <figure>
- <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#">
- <picture>
- {{- with $image }}
- {{- $image = .Content | resources.FromString (print (partial "function-paths.html" "media") "/" $.Data.user "/" (path.Base .)) }}
- <source srcset="{{- ($image.Fit (print $dimensions " webp")).RelPermalink -}}" type="image/webp" />
- {{- end }}
- <img
- alt="{{ .Data.name }}"
- {{- if fileExists $path }}
- {{ with $image }}
- {{- $image = (.Content | resources.FromString (print (partial "function-paths.html" "media") "/" $.Data.user "/" (path.Base .))).Fit $dimensions -}}
- width="{{ $image.Width }}"
- height="{{ $image.Height }}"
- src="{{ $image.RelPermalink }}"
- {{- end }}
- {{ else }}
- width="{{ $404image.Width }}"
- height="{{ $404image.Height }}"
- src="{{ $404image.RelPermalink }}"
+ <micro-thumbnail>
+ <figure>
+ <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#">
+ <picture>
+ {{- with $sourceset -}}
+ <source srcset="{{ $sourceset }}" type="image/webp" />
{{- end -}}
- />
- </picture>
- </a>
- </figure>
- </micro-thumbnail>
+ <img
+ width="{{ $width }}"
+ height="{{ $height }}"
+ src="{{ $source }}"
+ alt="{{ $alternate }}"
+ />
+ </picture>
+ </a>
+ </figure>
+ </micro-thumbnail>
+
<micro-header>
<h2><b>{{ .Data.name }}</b></h2>
<h3><a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#">@{{ .Data.user }}</a></h3>
</micro-header>
+
+ <p>{{ .Data.description | markdownify | plainify | htmlUnescape | truncate 60 "..." }}</p>
+
<a title="Follow with RSS Reader" href="{{ "" | absURL }}/{{ .Data.user }}/rss.xml">
{{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/rss.svg")) }}
<span>Follow</span>