diff --git a/layouts/partials/hero/background.html b/layouts/partials/hero/background.html
index a2c83d7a..9c1eb321 100644
--- a/layouts/partials/hero/background.html
+++ b/layouts/partials/hero/background.html
@@ -36,15 +36,11 @@
{{ end }}
- {{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}}
- {{ with . }}
-

- {{ end }}
- {{ else }}
- {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
-

- {{ end }}
+ {{ $imageURL := .RelPermalink }}
+ {{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
+ {{ $imageURL = (.Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x")).RelPermalink }}
{{ end }}
+