mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-25 12:01:37 +01:00
parent
009d3a2e1d
commit
2fea5a1062
@ -11,19 +11,19 @@
|
|||||||
{{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") }}
|
{{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") }}
|
||||||
{{- $prod := (hugo.IsProduction | or (eq .Site.Params.env "production")) }}
|
{{- $prod := (hugo.IsProduction | or (eq .Site.Params.env "production")) }}
|
||||||
{{- if (and (in $processableFormats $cover.MediaType.SubType) (ne .Site.Params.cover.responsiveImages false) (eq $prod true)) }}
|
{{- if (and (in $processableFormats $cover.MediaType.SubType) (ne .Site.Params.cover.responsiveImages false) (eq $prod true)) }}
|
||||||
<img srcset="{{- range $size := $sizes -}}
|
<img loading="lazy" srcset="{{- range $size := $sizes -}}
|
||||||
{{- if (ge $cover.Width $size) -}}
|
{{- if (ge $cover.Width $size) -}}
|
||||||
{{ printf "%s %s" (($cover.Resize (printf "%sx" $size)).Permalink) (printf "%sw ," $size) -}}
|
{{ printf "%s %s" (($cover.Resize (printf "%sx" $size)).Permalink) (printf "%sw ," $size) -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{- end -}}{{$cover.Permalink }} {{printf "%dw" ($cover.Width)}}"
|
{{- end -}}{{$cover.Permalink }} {{printf "%dw" ($cover.Width)}}"
|
||||||
sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.Permalink }}" alt="{{ $alt }}" />
|
sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.Permalink }}" alt="{{ $alt }}" />
|
||||||
{{- else }}{{/* Unprocessable image or responsive images disabled */}}
|
{{- else }}{{/* Unprocessable image or responsive images disabled */}}
|
||||||
<img src="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" alt="{{ $alt }}">
|
<img loading="lazy" src="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" alt="{{ $alt }}">
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}{{/* For absolute urls and external links, no img processing here */}}
|
{{- else }}{{/* For absolute urls and external links, no img processing here */}}
|
||||||
{{- if $addLink }}<a href="{{ (.Params.cover.image) | absURL }}" target="_blank"
|
{{- if $addLink }}<a href="{{ (.Params.cover.image) | absURL }}" target="_blank"
|
||||||
rel="noopener noreferrer">{{ end -}}
|
rel="noopener noreferrer">{{ end -}}
|
||||||
<img src="{{ (.Params.cover.image) | absURL }}" alt="{{ $alt }}">
|
<img loading="lazy" src="{{ (.Params.cover.image) | absURL }}" alt="{{ $alt }}">
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if $addLink }}</a>{{ end -}}
|
{{- if $addLink }}</a>{{ end -}}
|
||||||
{{/* Display Caption */}}
|
{{/* Display Caption */}}
|
||||||
|
Loading…
Reference in New Issue
Block a user