Skip to content

Commit be62c73

Browse files
authored
fix
1 parent 261298e commit be62c73

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

layouts/_default/_markup/render-image.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
{{- $imageTypes := slice -}}
1818
{{- if and hugo.IsExtended (ne $src.MediaType.Type "image/webp") -}}
1919
{{- $imageTypes = $imageTypes | append "webp" -}}
20+
{{- $imageTypes = $imageTypes | append "avif" -}}
2021
{{- end -}}
2122
{{- if gt (index $respSizes 0) $src.Width -}}
2223
{{- $respSizes = slice $src.Width -}}
@@ -29,14 +30,16 @@
2930
{{- if $cmSrc -}}
3031
{{ $cmSrc.RelPermalink | absURL}} 1080w
3132
{{- else -}}
32-
{{- $imageTypes = $imageTypes | append $src.MediaType.SubType -}}
33+
// hugo not support avif format
34+
{{ if eq $imageType "avif" }}
3335
{{- with $respSizes -}}
3436
{{- range $i, $e := . -}}
3537
{{- if ge $src.Width . -}}
3638
{{- if $i }}, {{ end -}}{{- ($src.Resize (print . "x " $imageType " " $filter) ).RelPermalink | absURL}} {{ . }}w
3739
{{- end -}}
3840
{{- end -}}
3941
{{- end -}}
42+
{{ end }}
4043
{{- end -}}" sizes="{{ $dataSizes }}" />
4144
{{- end -}}
4245
<img src="{{ $Destination | safeURL }}" width="{{ .Width }}" height="{{ .Height }}" alt="{{ $Text }}" title="{{ $Title }}" loading="lazy" />

0 commit comments

Comments
 (0)