Site logo

Archived topic

Preload Logo Img

9 replies · Started by Evenit on September 16, 2021

Viewing posts 1–10 of 10

Hi I would need to preload the logo of my website (is-logo-image class), may you provide please a code for doing it?
Thank you very much

Hi Evenit,

Can you let us know why would you want to preload the logo?

Are you using lazy load the logo image using cache plugin?

If so, you should be able to exclude it from being lazy load.

Let me know :)

Hi Ying, I have already excluded it from Lazy Loading, don't you think preloading it might bring some benefit to performance?

Hi there,

Hi Ying, I have already excluded it from Lazy Loading, don’t you think preloading it might bring some benefit to performance?

It can but do it only when necessary. If your logo image is pretty lightweight then you can skip this.

But preloading is worth a try. I suggest doing an A/B test to see what works best for you. :D

So may you provide please a code for doing it?

So may you provide please a code for doing it?

Can you link us to the site in question? To inspect the site and use it as basis for the code.

Note: If your site's optimization plugin has a preload feature, you may can skip coding. Optimization plugins normally allow users to preload images using their class selector.

I have added in the private box.
Thanks

Hi there,

If you want to preload an image, you can:

1. Create a new Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
2. Set the hook to wp_head.
3. Add this HTML:

<link rel="preload" href="URL TO YOUR LOGO" as="image" />

I'm not convinced you'll see a massive difference as the logo is likely one of the first things on the page to load, but worth a try if you want to.

thank you very much

No problem!

This archived topic is closed to new replies.