aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/author-header.html
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-08-28 00:08:03 -0400
committertdro <tdro@noreply.example.com>2022-08-28 00:08:03 -0400
commit5c08d7666c3b4f75207822344edb7f54e1c4b0cb (patch)
treecd180a073bc1988cfb99f7982e74a4d833164e31 /themes/default/layouts/partials/author-header.html
parentb77c159ae5cfc45e7fd80457e840e769fc97b555 (diff)
downloadcanory-5c08d7666c3b4f75207822344edb7f54e1c4b0cb.tar.gz
canory-5c08d7666c3b4f75207822344edb7f54e1c4b0cb.tar.bz2
canory-5c08d7666c3b4f75207822344edb7f54e1c4b0cb.zip
themes/default/layouts/partials/function-caches-images: Merge alternate copy properties
Compensate for fit and resize. Set images from user profile configuration.
Diffstat (limited to 'themes/default/layouts/partials/author-header.html')
-rw-r--r--themes/default/layouts/partials/author-header.html41
1 files changed, 20 insertions, 21 deletions
diff --git a/themes/default/layouts/partials/author-header.html b/themes/default/layouts/partials/author-header.html
index 6b2fca0..ddb4724 100644
--- a/themes/default/layouts/partials/author-header.html
+++ b/themes/default/layouts/partials/author-header.html
@@ -1,30 +1,29 @@
-{{- $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.html" "media") "/" $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
+ "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))
+ "OptimizedCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.BaseName $header) ".webp")
+ )
+-}}
+
+{{- with $image.OptRelPermalink -}}
+ <source srcset="{{ . }}" type="image/webp" />
{{- end -}}
<img
- {{ if fileExists $path }}
- {{- with $image -}}
- {{- $image = (.Content | resources.FromString (print (partial "function-paths.html" "media") "/" $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. */ -}}