aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/author-header.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/layouts/partials/author-header.html')
-rw-r--r--themes/default/layouts/partials/author-header.html42
1 files changed, 21 insertions, 21 deletions
diff --git a/themes/default/layouts/partials/author-header.html b/themes/default/layouts/partials/author-header.html
index 9babf1d..5bcc0e6 100644
--- a/themes/default/layouts/partials/author-header.html
+++ b/themes/default/layouts/partials/author-header.html
@@ -1,30 +1,30 @@
-{{- $file := "/profile/header.jpg" -}}
-{{- $path := print "public/" (partial "author-media-path.html" .) $file -}}
-{{- $image := resources.Get $path -}}
-{{- $404image := resources.Get "data/media/404.png" -}}
-{{- $dimensions := "x600" -}}
-{{- $author := partial "author-user.html" . }}
+{{- $author := partial "function-authors-data.html" . -}}
+{{- $header := $author.picture.header -}}
+{{- $file := not (urls.Parse $header).Host -}}
-{{- with $image -}}
- {{- $image = .Content | resources.FromString (print (partial "function-paths-media.html") "/" $author "/" (path.Base .)) -}}
- <source srcset="{{- ($image.Resize (print $dimensions " webp")).RelPermalink -}}" type="image/webp" />
+{{- if $file -}}
+ {{- $header = print $author.user "/" $header -}}
+{{- end -}}
+
+{{- $image := partial "function-caches-images.html"
+ (dict
+ "Context" .
+ "Source" $header
+ "Resize" "x600"
+ "Target" (print (partial "function-paths.html").media "/" $author.user "/")
+ "Copy" (print (partial "function-paths.html").media "/" $author.user "/" (path.Base $header))
+ "AlternateCopy" (print (partial "function-paths.html").media "/" $author.user "/" (path.BaseName $header) ".webp")
+ )
+-}}
+
+{{- with $image.AltRelPermalink -}}
+ <source srcset="{{ . }}" type="image/webp" />
{{- end -}}
<img
- {{ if fileExists $path }}
- {{- with $image -}}
- {{- $image = (.Content | resources.FromString (print (partial "function-paths-media.html") "/" $author "/" (path.Base .))).Resize $dimensions -}}
width="{{ $image.Width }}"
height="{{ $image.Height }}"
src="{{ $image.RelPermalink }}"
- {{- else -}}
- src="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}{{ $file }}"
- {{ end }}
- {{- else -}}
- width="{{ $404image.Width }}"
- height="{{ $404image.Height }}"
- src="{{ $404image.RelPermalink }}"
- {{- end }}
- alt="{{ partial "author-name.html" . }}"
+ alt="{{ $author.name }}"
/>
{{- /* This comment removes trailing newlines and white spaces. */ -}}