Skip to content

Commit

Permalink
fix: mark AVIF images as unresizable
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Mar 24, 2022
1 parent ff55997 commit dd09a8b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions layouts/partials/helpers/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{- $pageResource := false -}}
{{- $link := "" -}}
{{- $resizable := false -}}
{{- $unresizable := slice ".svg" -}}
{{- $unresizable := slice ".svg" ".avif" -}}
{{- $url := urls.Parse .filename -}}
{{- if not $url.Scheme -}}
{{- $resource := .resources.GetMatch (strings.TrimPrefix "/" $url.Path) -}}
Expand All @@ -17,8 +17,10 @@
{{- else -}}
{{- $filename := path.Join "static" $url.Path -}}
{{- if fileExists $filename -}}
{{- $img = imageConfig $filename -}}
{{- $link = .filename | absURL }}
{{- if not (in $unresizable ($link | path.Ext | lower)) -}}
{{- $img = imageConfig $filename -}}
{{- end -}}
{{- else -}}
{{- warnf "no such image can be found in page resources and the static folder: %s" .filename -}}
{{- end -}}
Expand Down

0 comments on commit dd09a8b

Please sign in to comment.