hugo-typo/layouts
Sangeeth Sudheer 47ba12bd1c
Add width and height attrs for local images
Image render hook now computes width/height of local images and adds
them as attributes. This patch also adds relevant CSS changes to prevent
stretchy images.

The main reason for this change is to avoid content shifts when images
load. Without providing width/height, browser doesn't have info to know
the aspect ratio to reserve some space until the image loads. With this
change, browser knows the intrinsic size and aspect-ratio to reserve
space and avoid content shifts in the page.

I believe this also fixes an issue I face in Safari where sometimes, an
image below the fold wouldn't load and thus have zero height because it
has loading="lazy".

To avoid images getting stretched and images overflow/filling the entire
screen when their intrinsic size is larger than the container size, I've
added some CSS. A configurable `max-height` is present which is used for
`figure img` elements. This especially helps when you have tall images
like mobile screenshots.
2024-11-17 17:21:02 +05:30
..
_default Add width and height attrs for local images 2024-11-17 17:21:02 +05:30
partials Merge pull request #38 from runofthemillgeek/feat/link-main-title-to-home-page 2024-10-29 17:04:10 +01:00
404.html Format 2024-05-11 22:13:47 +02:00