RFC: Support priority=true
for Images to allow preloading.
#382
Replies: 4 comments 13 replies
-
Similar issue: #360 As to #360 (comment)
|
Beta Was this translation helpful? Give feedback.
-
I’m guessing the tricky part here is that because we stream our pages, by the time we reach the I guess one way is to use |
Beta Was this translation helpful? Give feedback.
-
One year later, still looking for a proper solution. |
Beta Was this translation helpful? Give feedback.
-
It's not super ergonomic, but in the latest versions of Astro, Ultimately, this is still complicated to do automatically because of streaming and SSR, as is every thing that has to touch the head while being further down the page |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey this RFC is based on this issue withastro/astro#5302
The Problem
Currently, we have to preload images like this:
layout.astro
hero.astro
Result
As you can see both of the hash after the filename is different, thus it defeats the purpose. Instead it loads two completely different image.
Proposed Solution
There should be an option called
priority=true
for@astro/image
so Astro can automatically include that image for preloading.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-edxsa5?file=src/pages/index.astro
If anyone is willing to submit a PR, please reply.
Beta Was this translation helpful? Give feedback.
All reactions