astro-embed icon indicating copy to clipboard operation
astro-embed copied to clipboard

Astro Image Asset Not Used

Open jesseagleboy opened this issue 1 year ago • 3 comments

I'm a little confused as to why the source file for the Preview component is using a standard img tag rather than integrate the Astro Image tag?

image

jesseagleboy avatar Sep 04 '24 23:09 jesseagleboy

#111 started some work around this although unfortunately haven’t had time to look at it yet.

The image source in this case is remote (a URL provided by the site the preview link is for), so in any case Astro’s <Image> wouldn’t optimise without additional configuration (see “Remote Images” in the Astro Docs).

delucis avatar Sep 05 '24 08:09 delucis

Thanks for following up. I realized that it wouldn't have mattered after I made this post. I switched Astro's Image handler to Unpic's service so I noticed a change in the image tags.

jesseagleboy avatar Sep 05 '24 18:09 jesseagleboy

It now seems to be possible to let Astro import remote images. It's not perfect but it could be a good improvement compared to plain <img /> tags

https://docs.astro.build/en/guides/images/#remote-images

Remote images from other sources will not be optimized, but using the <Image /> component for these images will prevent Cumulative Layout Shift (CLS).

Greenheart avatar Jul 07 '25 08:07 Greenheart