From 461c269f8fd2f3db5c6aae37bf02191a05fedc25 Mon Sep 17 00:00:00 2001 From: Razon Yang Date: Sun, 10 Mar 2024 06:05:49 +0800 Subject: [PATCH] fix: remove unit from width and height attributes for public images (#46) fix: add unit for width and height inline style attributes --- layouts/partials/images/image.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/layouts/partials/images/image.html b/layouts/partials/images/image.html index 5fb2da8..8bedf2f 100644 --- a/layouts/partials/images/image.html +++ b/layouts/partials/images/image.html @@ -160,8 +160,8 @@ {{/* Process static image. */}} {{- $src = absURL $url.Path }} {{- with imageConfig $filepath }} - {{- $naturalHeight = printf "%dpx" .Height }} - {{- $naturalWidth = printf "%dpx" .Width }} + {{- $naturalHeight = .Height }} + {{- $naturalWidth = .Width }} {{- end }} {{/* hash by the date. */}} {{- $hash := "" }} @@ -190,10 +190,10 @@ {{- if $src }} {{/* Inline style. */}} {{- if and $height (ne $height $naturalHeight) }} - {{- $style = $style | append (printf "height: %s" $height) }} + {{- $style = $style | append (printf "height: %spx" $height) }} {{- end }} {{- if and $width (ne $width $naturalWidth) }} - {{- $style = $style | append (printf "width: %s" $width) }} + {{- $style = $style | append (printf "width: %spx" $width) }} {{- end }} {{- $ctx := dict "sources" $sources