{{- $content := $author.name | default "Anonymous" -}}
{{- $icon := dict "Class" "fa-solid fa-user-circle" -}}
{{- /* Deprecate $params.authorAvatar in favor of $params.showAvatar and add front matter gravatar {bool} */ -}}
{{- if $author.avatar | and $params.authorAvatar -}}
- {{- $content = printf "%v %v" (dict "Src" $author.avatar "Class" "avatar" "Alt" $content "Width" 20 "Height" 20 | partial "plugin/image.html") $content -}}
+ {{- $content = printf "%v %v" (dict "Src" $author.avatar "Class" "avatar" "Alt" $content "Width" 16 "Height" 16 "OptimConfig" $optim | partial "plugin/image.html") $content -}}
{{- $icon = "" -}}
{{- end -}}
{{- if $author.link -}}
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index eb4fea2b..c7bdea61 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -137,12 +137,20 @@
{{- /* Featured image */ -}}
{{- $image := $params.featuredimage -}}
+ {{- with dict "Path" $image "Resources" .Resources | partial "function/resource.html" }}
+ {{- $image = .RelPermalink }}
+ {{- end }}
{{- with .Resources.GetMatch "featured-image" -}}
{{- $image = .RelPermalink -}}
{{- end -}}
{{- with $image -}}
- {{- dict "Src" . "Title" $.Description | partial "plugin/image.html" -}}
+ {{- $optim := slice
+ (dict "Process" "resize 800x webp q75" "descriptor" "800w")
+ (dict "Process" "resize 1200x webp q75" "descriptor" "1200w")
+ (dict "Process" "resize 1600x webp q75" "descriptor" "1600w")
+ -}}
+ {{- dict "Src" . "Title" $.Description "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- end -}}
diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html
index fa0776f5..aee6d35e 100644
--- a/layouts/shortcodes/image.html
+++ b/layouts/shortcodes/image.html
@@ -3,16 +3,22 @@
{{- $caption := cond .IsNamedParams (.Get "caption") (.Get 2) | .Page.RenderString -}}
{{- $options = dict "Caption" $caption | merge $options -}}
{{- $options = dict "Resources" .Page.Resources | merge $options -}}
+{{- $optim := slice
+ (dict "Process" "resize 800x webp q75" "descriptor" "800w")
+ (dict "Process" "resize 1200x webp q75" "descriptor" "1200w")
+ (dict "Process" "resize 1600x webp q75" "descriptor" "1600w")
+-}}
+{{- $options = dict "OptimConfig" $optim | merge $options -}}
{{- if .IsNamedParams -}}
{{- $options = dict "Title" (.Get "title") | merge $options -}}
- {{- $options = dict "SrcSmall" (.Get "src_s") | merge $options -}}
- {{- $options = dict "SrcLarge" (.Get "src_l") | merge $options -}}
{{- $options = dict "Height" (.Get "height") | merge $options -}}
{{- $options = dict "Width" (.Get "width") | merge $options -}}
{{- $options = .Get "linked" | ne false | dict "Linked" | merge $options -}}
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
- {{- $options = dict "Loading" (.Get "loading") | merge $options -}}
+ {{- $options = dict "Loading" (.Get "loading" | default "lazy") | merge $options -}}
+ {{- with (.Get "optimise") -}}{{- $options = dict "Optimise" . | merge $options -}}{{- end -}}
+ {{- with (.Get "cacheRemote") -}}{{- $options = dict "CacheRemote" . | merge $options -}}{{- end -}}
{{- else -}}
{{- $options = cond $caption true false | dict "Linked" | merge $options -}}
{{- end -}}