File tree Expand file tree Collapse file tree 3 files changed +11
-164
lines changed Expand file tree Collapse file tree 3 files changed +11
-164
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 17
17
{{- if and hugo.IsExtended (ne $src.MediaType.Type "image/webp") -}}
18
18
{{- $imageTypes = $imageTypes | append "webp" -}}
19
19
{{- end -}}
20
- {{- $imageTypes = $imageTypes | append $src.MediaType.SubType -}}
21
20
{{- if gt (index $respSizes 0) $src.Width -}}
22
21
{{- $respSizes = slice $src.Width -}}
23
22
{{- end -}}
24
23
< picture >
25
24
{{- range $imageType := $imageTypes -}}
26
25
< source type ="image/{{ $imageType }} " srcset ="
27
- {{- with $respSizes -}}
28
- {{- range $i, $e := . -}}
29
- {{- if ge $src.Width . -}}
30
- {{- if $i }}, {{ end -}}{{- ($src.Resize (print . "x " $imageType " " $filter) ).RelPermalink | absURL}} {{ . }}w
26
+ {{- compressedImage := printf "%s_1080x.%s " .Destination $imageType -}}
27
+ {{- $cmSrc := .Page.Resources.GetMatch $compressedImage -}}
28
+ {{- if $cmSrc -}}
29
+ {{ $cmSrc.RelPermalink | absURL}} 1080w
30
+ {{- else -}}
31
+ {{- $imageTypes = $imageTypes | append $src.MediaType.SubType -}}
32
+ {{- with $respSizes -}}
33
+ {{- range $i, $e : = . -}}
34
+ {{- if ge $src.Width . -}}
35
+ {{- if $i }}, {{ end -}}{{- ($src.Resize (print . "x " $imageType " " $filter) ).RelPermalink | absURL}} {{ . }}w
36
+ {{- end -}}
31
37
{{- end -}}
32
38
{{- end -}}
33
39
{{- end -}}" sizes="{{ $dataSizes }} " />
You can’t perform that action at this time.
0 commit comments