Skip to content

Commit

Permalink
fix: do not apply imageConfig on avif and jxl images (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Mar 15, 2024
1 parent 184bce7 commit 767df64
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions layouts/partials/images/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{{- $page := default page .Page }}
{{- $url := urls.Parse $filename }}
{{- $params := $url.Query }}
{{- $ext := path.Ext $url.Path }}
{{/* Initialize image properties. */}}
{{- $src := "" }}
{{- $style := default slice .Style }}
Expand Down Expand Up @@ -159,9 +160,11 @@
{{- if fileExists $filepath }}
{{/* Process static image. */}}
{{- $src = absURL $url.Path }}
{{- with imageConfig $filepath }}
{{- $naturalHeight = .Height }}
{{- $naturalWidth = .Width }}
{{- if not (in (slice ".avif" ".jxl") $ext) }}
{{- with imageConfig $filepath }}
{{- $naturalHeight = .Height }}
{{- $naturalWidth = .Width }}
{{- end }}
{{- end }}
{{/* hash by the date. */}}
{{- $hash := "" }}
Expand Down

0 comments on commit 767df64

Please sign in to comment.