Site logo

[Support request] Ensure text remains visible during webfont load Page Insights

Home Forums Support [Support request] Ensure text remains visible during webfont load Page Insights

Home Forums Support Ensure text remains visible during webfont load Page Insights

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1742118
    Sam

    Hello,

    I am getting this error along with a couple of others in lighthouse page speed test. I have tested my home page and a couple of image heavy blog posts. I was hoping you could help. Linking my site below.

    #1742447
    Elvin
    Staff
    Customer Support

    Hi therem

    You can try adding this:

    add_filter( 'generate_google_font_display', function() {
        return 'swap';
    } );

    Here’s how to add PHP: https://docs.generatepress.com/article/adding-php/

    Let us know how it goes.

    #1743665
    Sam

    Thank you, that worked. Are there any fixes for some of the other errors coming up in lighthouse? I would attach the screen shot but I am no sure how.

    #1743824
    Sam

    Also, is the php you gave me the same as adding omgf google font plugin?

    Thanks,
    sam

    #1743858
    Elvin
    Staff
    Customer Support

    Thank you, that worked. Are there any fixes for some of the other errors coming up in lighthouse?

    Can you open up a new topic for it? I’ve checked your site and there’s quite a lot to tackle.

    …I would attach the screen shot but I am no sure how.

    Check the recommendations here.
    https://docs.generatepress.com/article/using-the-premium-support-forum/#uploading-screenshots

    Or use CloudApp, Loom or Screencast.

    Also, is the php you gave me the same as adding omgf google font plugin?

    Not exactly sure what that plugin does but the principle is generally the same. It’s all about preloading the font, or in this case, setting font-display: swap; on the requested Google fonts.

    #1743867
    Sam

    Hello – opening new ticket now. thanks!

    #1743875
    Elvin
    Staff
    Customer Support

    No problem. 🙂

    #1910617
    NeedForGaming

    How to add this code
    add_filter( ‘generate_google_font_display’, function() {
    return ‘swap’;
    } );

    #1910816
    David
    Staff
    Customer Support

    Hi there,

    that is a PHP Snippet – this article explains how to add:

    https://docs.generatepress.com/article/adding-php/

    Please note: Adding display swap may remove the: Ensure text remains visible during webfont load Page Insights diagnostic on Google PSI. BUT it can lead to CLS issues. I would only use that option if i am 100% sure that the font swapping won’t cause CLS.

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