Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Complex homepage page with many queries to posts, slow LCP due to background ima

  • Hi!

    I have an online newspaper frontpage with many posts loaded by many queries. It is based on Info starter site.

    I get a mediocre Pagespeed score due to the fact that all the featured images from posts are added as

    
    style="--background-image: url(https://...;"
    

    and it results in significant load delay.

    How can I force WP to add the first X (any number) of these images for preload?

    Any solutions are appreciated.

  • Hi there,

    Featured images added as background images via CSS cannot be preloaded because they’re not part of the DOM and therefore not accessible to preload directives.

    If you replace those background images with standard Image blocks, we can use a snippet to preload them properly.

  • That is what I was afraid of.

    Do you know any plugins that are able to do this?

    Because changing the design is not the preferred solution, what do you think about putting a hidden element on the top to pre-load the images?

  • I don’t know a plugin that does this, unfortunately!

    But you can tweak the background images on the page, for example, choose medium size instead of full or large can help with performance.

  • For reference later:
    I tested LiteSpeed cache plugin and it did some improvements.

  • Glad to hear that 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.