use get-image
partial
This commit is contained in:
parent
ed9e769b2d
commit
edba5d203e
8 changed files with 94 additions and 47 deletions
|
@ -32,17 +32,14 @@
|
|||
<article
|
||||
class="item-tile lazy {{- with .Params.site }}item-tile--{{ . }}{{ end -}}"
|
||||
{{ if .Params.featured_image }}
|
||||
style="background-image: url(
|
||||
{{ with .Resources.GetMatch .Params.featured_image }}
|
||||
{{ if ( in ( slice "avif" "svg" "gif" ) .MediaType.SubType ) }}
|
||||
style="background-image: url({{ .RelPermalink }})"
|
||||
{{ else }}
|
||||
{{ with .Resize "1000x webp" }}
|
||||
style="background-image: url({{ .RelPermalink }})"
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
style="background-image: url({{ .Params.featured_image }})"
|
||||
{{ end }}
|
||||
{{- partialCached "images/get-image.html" ( dict "img" . "size" "500x" ) ( printf "%s-500x" .Title ) -}}
|
||||
{{- else -}}
|
||||
{{- warnf "Featured image %s is not a page resource" .Params.featured_image -}}
|
||||
{{- .Params.featured_image -}}
|
||||
{{- end -}}
|
||||
)"
|
||||
{{ end }}
|
||||
>
|
||||
{{ 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="
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue