diff --git a/layouts/partials/paige/img.html b/layouts/partials/paige/img.html
index 0066ecaf..651bc5a7 100644
--- a/layouts/partials/paige/img.html
+++ b/layouts/partials/paige/img.html
@@ -65,44 +65,30 @@
{{ $height = "auto" }}
{{ end }}
+{{ $styles := slice }}
+
{{ if $height }}
- {{ with printf "height: %v" $height }}
- {{ if $style }}
- {{ $style = printf "%v; %v" $style . }}
- {{ else }}
- {{ $style = . }}
- {{ end }}
- {{ end }}
+ {{ $styles = $styles | append (print "height: " $height) }}
{{ end }}
{{ if $maxheight }}
- {{ with printf "max-height: %v" $maxheight }}
- {{ if $style }}
- {{ $style = printf "%v; %v" $style . }}
- {{ else }}
- {{ $style = . }}
- {{ end }}
- {{ end }}
+ {{ $styles = $styles | append (print "max-height: " $maxheight) }}
{{ end }}
{{ if $maxwidth }}
- {{ with printf "max-width: %v" $maxwidth }}
- {{ if $style }}
- {{ $style = printf "%v; %v" $style . }}
- {{ else }}
- {{ $style = . }}
- {{ end }}
- {{ end }}
+ {{ $styles = $styles | append (print "max-width: " $maxwidth) }}
{{ end }}
{{ if $width }}
- {{ with printf "width: %v" $width }}
- {{ if $style }}
- {{ $style = printf "%v; %v" $style . }}
- {{ else }}
- {{ $style = . }}
- {{ end }}
- {{ end }}
+ {{ $styles = $styles | append (print "width: " $width) }}
+{{ end }}
+
+{{ $styles = delimit $styles "; " }}
+
+{{ if $style }}
+ {{ $style = print $style "; " $styles }}
+{{ else }}
+ {{ $style = $styles }}
{{ end }}