File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change 1515{{- $options := .Get "options" | default "800x webp q80" -}}
1616{{- $process := .Get "process" | default (printf "%s %s" $method $options) -}}
1717
18- {{- with or (.Page.Resources.Get $image) (resources.Get $image) -}}
19- {{/* Retrieve the $image resource from local or global resources */}}
20- {{- $processed := .Process $process -}}
21- {{- $width = $processed.Width -}}
22- {{- $height = $processed.Height -}}
23- {{- $image = $processed.RelPermalink -}}
24- {{ else }}
25- {{/* Otherwise, use relative link of the image */}}
26- {{- if hasPrefix $image "/" -}}
27- {{- $image = relURL (strings.TrimPrefix "/" $image) -}}
18+ {{- if and $image (not (urls.Parse $image).Scheme) -}}
19+ {{- with or (.Page.Resources.Get $image) (resources.Get $image) -}}
20+ {{/* .Process does not work on svgs */}}
21+ {{- if (not (eq .MediaType.SubType "svg")) -}}
22+ {{/* Retrieve the $image resource from local or global resources */}}
23+ {{- $processed := .Process $process -}}
24+ {{- $width = $processed.Width -}}
25+ {{- $height = $processed.Height -}}
26+ {{- $image = $processed.RelPermalink -}}
27+ {{- end -}}
28+ {{ else }}
29+ {{/* Otherwise, use relative link of the image */}}
30+ {{- if hasPrefix $image "/" -}}
31+ {{- $image = relURL (strings.TrimPrefix "/" $image) -}}
32+ {{- end -}}
2833 {{- end -}}
2934{{- end -}}
3035
You can’t perform that action at this time.
0 commit comments