- This topic has 22 replies, 2 voices, and was last updated 2 years, 4 months ago by David.
-
AuthorPosts
-
December 13, 2021 at 10:47 pm #2048258Puneet
I had removed it when I didn’t see any improvements. Have put the code back again.
December 14, 2021 at 2:10 am #2048401DavidStaffCustomer SupportDecember 14, 2021 at 2:36 am #2048446PuneetStrangely, still not reflecting at my end. I will let it hang in for a few days. What is the code doing, actually?
December 14, 2021 at 3:02 am #2048480DavidStaffCustomer SupportWordPress uses
src-set
, which contain the list of various media attachment size URLs, and asizes
attribute that ‘guides’ the browser as to what image to load under different conditions.The default
sizes
attribute that WP generates is a catch-all that relies on the image filling 100% of the viewport width. When it does fill the width then the browser generally selects the optimal image size… when it don’t fill the space then browsers have a habit of grabbing a larger image then required.The code i provided rewrites the
sizes
attribute to:(max-width: 360px) 300px, (min-width: 361px) 768px, (min-width: 769px) 1024px, 100vw
Which gives the browser a new rule set for selecting images.
Simply put – on smaller screens we’re asking the browser to use a smaller image.December 14, 2021 at 9:32 am #2049058PuneetThanks David,
I ended up changing my hosting again and that seemed to have improved the scores for me now. This all seems settled for now at least. Couldn’t help noticing that the properly size images error has disappeared from the mobile section after putting in the code. But it still appears in the desktop tab. Can that be sorted out as well?I also wanted to express my gratitude for all the help and that too promptly. I have had good support from other themes as well but Generatepress Team has started to feel like family. Great stuff guys and thanks once again.
Regards,
PuneetDecember 15, 2021 at 3:01 am #2049627DavidStaffCustomer SupportI ran a few tests on the site, and i didn’t see any opportunities for ‘Properly size images’ – if theres a specific URL then let me know.
And thanks for the kind feedback!!
December 15, 2021 at 3:32 am #2049649PuneetNot under the mobile section but it shows properly size images under the desktop section.
Example URL: https://geekyfi.com/movies/sandra-bullock-interview-the-unforgivable-netflix/
Though I wouldn’t bother much about it as the overall score is good anyways, LCP and FCP are green and that is what matters.
Closing the ticket. Thanks a ton for your help,
Regards,
PuneetDecember 15, 2021 at 4:24 am #2049715DavidStaffCustomer SupportI think its just Google and its server caches – ran a couple of tests on that URL and it looks good.
And the scores are great – so i am glad to have been of help !! -
AuthorPosts
- You must be logged in to reply to this topic.