-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed size with dynamic values and lazy loading with fetchpriority #135
Conversation
buggyzap
commented
Jan 23, 2024
Questions | Answers |
---|---|
Description? | Width and height can't be static but depends on image resize so I have changed it with dynamic values coming from controller. I have also changed the lazy loading with the attribute fetchpriority=high because, with new SEO standard we except that the cover image, ideally is in the visible First Contentful Paint and we need to load category cover image as soon as possible, to distinguish other images from cover we need to tell what to load first thanks with this attribute. |
Type? | improvement |
BC breaks? | no |
Deprecations? | no |
How to test? | At page load we can see new values, testing the page with Google audit we notice that in network the cover image is loaded before other images. |
Hello @buggyzap, I want to test your PR but I don't understand. Can you provide me with clear steps to reproduce allowing me to see the changes? Thanks for your feedback! 🙏 |
Hi @paulnoelcholot, there are 2 improvements on this PR, a change in image size that was hardcoded in 141x180 ( you can look at file changes ) and the attribute loading=lazy that is changed in fetchpriority=high. To reproduce the first bug
To see changes on second improvement, you need to know what loading and fetchpriority attributes mean. I will try to resume to you, the previous attribute "loading=lazy" tells to browser to load the image only if it is visible to viewport to the end-user, instead, the "fetchpriority=high" is useful to tells to browser that this image, is a most important image of the page, so it is critical to load it first because its view will impact the LCP time. LCP is the Largest Contentful Paint, the element in the viewport viewed by end-user will impact this metrics in Web Vitals. To accomplish this task we can set it to fetchpriority=high and write a most modern and better code with these new attributes. Thanks |
Hi @paulnoelcholot friendly reminder |
Hi @paulnoelcholot friendly reminder... |
Tested, working. More info here - https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchPriority |