{{ if .Params.featured_image -}} @@ -51,15 +48,10 @@ style="display: none;" src=" {{- with .Resources.GetMatch .Params.featured_image -}} - {{- if ( in ( slice "avif" "svg" "gif" ) .MediaType.SubType ) -}} - {{ .RelPermalink }} - {{- else -}} - {{- with .Resize "1000x webp" -}} - {{- .RelPermalink -}} - {{- end -}} - {{- end -}} + {{- partialCached "images/get-image.html" ( dict "img" . "size" "500x" ) ( printf "%s-500x" .Title ) -}} {{- else -}} - {{ .Params.featured_image }} + {{- warnf "Featured image %s is not a page resource" .Params.featured_image -}} + {{- .Params.featured_image -}} {{ end }} " alt=" diff --git a/layouts/partials/media/picture.html b/layouts/partials/media/picture.html index f611416..cb26816 100644 --- a/layouts/partials/media/picture.html +++ b/layouts/partials/media/picture.html @@ -1,12 +1,15 @@ -{{- $src := . -}} +{{- $src := .src -}} +{{- $hint := default ( index $src.Params "hint" ) "" }} +{{- $format := cond ( and ( isset . "raw" ) .raw ) "" "webp" -}} {{- $isResizable := not ( in ( slice "svg" "gif" ) $src.MediaType.SubType ) -}} @@ -17,18 +20,30 @@ itemprop="image" > {{ if $isResizable -}} - - + {{- if gt $src.Width 1200 -}} + + {{- end -}} + {{- if gt $src.Width 800 -}} + + {{- end -}} {{- end }} {{- $src := $.Page.Resources.GetMatch ( .Get "src" ) -}} +{{- $raw := default false ( .Get "raw" ) -}} {{- $linkedResource := $.Page.Resources.GetMatch ( .Get "link" ) -}} {{- $valid_rel_values := partialCached "util/get_valid_rel_values.html" . -}} @@ -37,7 +39,7 @@ {{- end -}} {{- end -}} -{{- partial "media/picture.html" $src -}} +{{- partial "media/picture.html" ( dict "src" $src "raw" $raw ) -}} {{- if .Get "link" -}} {{- end -}}