diff options
author | Sangeeth Sudheer <git@sangeeth.dev> | 2025-03-15 21:46:53 +0530 |
---|---|---|
committer | Sangeeth Sudheer <git@sangeeth.dev> | 2025-03-15 21:46:55 +0530 |
commit | bd0b95d5076033e88bf1436b8b79e3abcf0353f5 (patch) | |
tree | 453be84383993ec07ecfe5e23398434e34bfbf10 /layouts/_default/_markup | |
parent | 6b9ab29f530b46850daf9ba4b6aa79e190c063f1 (diff) |
Remove `px` from width/height img attributes in render-image hook
As per the spec, width/height attrs should be non-negative integers but
currently, they are being rendered with a `px` suffix. This change removes
the suffix which hopefully fixes any outstanding layout shifts.
References:
- https://html.spec.whatwg.org/multipage/embedded-content-other.html#dimension-attributes
Diffstat (limited to 'layouts/_default/_markup')
-rw-r--r-- | layouts/_default/_markup/render-image.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 679fd76..e6a5c39 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -47,7 +47,7 @@ and build the img class string as "img-tag1 img-tag2 ..." <figure class="{{ $classes }}"> <div> - <img loading="lazy" alt="{{ .Text }}" src="{{ $url }}" {{ with $imgResource }}width="{{ .Width }}px" height="{{ .Height }}px"{{ end }}> + <img loading="lazy" alt="{{ .Text }}" src="{{ $url }}" {{ with $imgResource }}width="{{ .Width }}" height="{{ .Height }}"{{ end }}> </div> {{ with .Title }} |