Skip to content

Commit

Permalink
fix: Don't process svg images (#1403)
Browse files Browse the repository at this point in the history
  • Loading branch information
wu0407 authored Dec 19, 2024
1 parent d3d5fe2 commit 2378682
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions layouts/partials/plugin/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,14 @@
{{- end -}}
{{- end -}}

{{- $isSvg := false -}}
{{- if $resource -}}
{{- $isSvg = (eq $resource.MediaType.SubType "svg") -}}
{{- end -}}

{{- $optim := .OptimConfig -}}
{{- $srcset := "" -}}
{{- if $optim | and $resource | and $optimise -}}
{{- if $optim | and $resource | and $optimise | and (not $isSvg) -}}
{{ $srcsetSlice := slice -}}
{{- range $optim -}}
{{- if .Process -}}
Expand All @@ -65,8 +70,12 @@

{{- $src := $resource.RelPermalink | default .Src -}}
{{- $alt := .Alt | default .Title -}}
{{- $height := .Height | default $resource.Height | default "" -}}
{{- $width := .Width | default $resource.Width | default "" -}}
{{- $height := .Height -}}
{{- $width := .Width -}}
{{- if not $isSvg -}}
{{- $height = $height | default $resource.Height | default "" -}}
{{- $width = $width | default $resource.Width | default "" -}}
{{- end -}}

{{- if .Linked -}}
<a class="lightgallery" href="{{ $src }}" title="{{ .Title | default .Alt }}" data-thumbnail="{{ $src }}"{{ with .Caption }} data-sub-html="<h2>{{ . }}</h2>{{ with $.Title }}<p>{{ . }}</p>{{ end }}"{{ end }}{{ with .Rel }} rel="{{ . }}"{{ end }}>
Expand Down

0 comments on commit 2378682

Please sign in to comment.