File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
hugo-modules/core/utils/asset Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 50
50
{{- $width := .width -}}
51
51
{{- $height := .height -}}
52
52
{{- range $srcsets -}}
53
- < source sizes ="{{- $local_sizes -}} " srcset ="{{- .srcset -}} " type ="{{- .type -}} ">
53
+ {{ $srcset := .srcset | default "" }}
54
+ {{ $type := .type | default ""}}
55
+ < source sizes ="{{- $local_sizes -}} " srcset ="{{- $srcset -}} " type ="{{- $type -}} ">
54
56
{{- $preload_attr := (dict
55
57
"as" "image"
56
58
"imagesizes" $local_sizes
57
- "imagesrcset" . srcset
58
- "type" . type
59
+ "imagesrcset" $ srcset
60
+ "type" $ type
59
61
) -}}
60
- {{- if and $preload (eq . type "image/avif") (not (in ($globals.Scratch.Get "preload") $preload_attr)) -}}
62
+ {{- if and $preload (eq $ type "image/avif") (not (in ($globals.Scratch.Get "preload") $preload_attr)) -}}
61
63
{{- $globals.Scratch.Add "preload" (slice $preload_attr) -}}
62
64
{{- end -}}
63
65
{{- end -}}
72
74
"href" $src
73
75
"type" $mime_type
74
76
) -}}
75
- {{- if and $preload (eq .type "image/avif") ( not (in ($globals.Scratch.Get "preload") $preload_attr)) -}}
77
+ {{- if and $preload (not (in ($globals.Scratch.Get "preload") $preload_attr)) -}}
76
78
{{- $globals.Scratch.Add "preload" (slice $preload_attr) -}}
77
79
{{- end -}}
78
80
{{- end -}}
You can’t perform that action at this time.
0 commit comments