• Resolved shreyaam

    (@shreyaam)


    I got some CLS issues with google fonts. I am a non-technical person and want to know how to resolve this issue. I went through some related issues on this forum but could not get a clear idea. A straightforward step-by-step to resolve it would be very helpful. The font that I used in this grid is Nunito Sans with “Use Google Fonts API” box checked and “Enable Dynamic Data” is also checked. The pagespeedinsights score for Desktop is 0.185 and for mobile, it is 0.096.

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • ying

    (@yingscarlett)

    Hi there,

    GP Premium has the font library module which allows you to locally install Google fonts.

    If you do not have GP Premium, then try follow this instruction to install Google fonts locally:

    https://docs.generatepress.com/article/adding-local-fonts/

    I would recommend only install the font weight that you actually use to reduce the size of the font file.

    Thread Starter shreyaam

    (@shreyaam)

    Thanks Ying. I have the free theme. I followed the steps and added the add_filter function in the code snippet and activated it. But WP does not let me upload the font files. What can be done in this case? Please see the images attached.

    Alvind

    (@alvindcaesar)

    Hi there,

    Try adding this line inside the function:

    $mimes['woff2'] = 'application/font-woff2';

    The retry the upload.

    Thread Starter shreyaam

    (@shreyaam)

    Thanks Alvind. There seems to be some syntax error in this line, as WP shows.

    Thread Starter shreyaam

    (@shreyaam)

    I just removed the #091 and it worked like charm. Thanks a lot.

    Alvind

    (@alvindcaesar)

    Glad to hear that!

    Thread Starter shreyaam

    (@shreyaam)

    I was able to install the font ‘IBM Plex Sans” locally, as per the instructions sent. But I am still getting 2 CLS errors:
    1. gb container error
    2. <p> error
    What can be done to remove these two. I have my intro para in a container structure.

    David

    (@diggeddy)

    Hi there,

    in your @fontface CSS you have the font-display: swap; property.
    Change that to:
    font-display: auto;

    Thread Starter shreyaam

    (@shreyaam)

    Thanks David. I changed the @fontface to “auto” in Additional CSS. On mobile, CLS is now in green, but for Desktop, there are still 2 font errors, one in the GenerateBlock’s QueryLoop in which I inserted a Grid and the other in the navigation bar. I have locally installed IBM PLEX Sans font (with variations 300 and 500 only). But it seems to load “Roboto” font from gstatic (visible when I hover the gstatic fonts link under CLS error section on PageSpeed Insights) and may be that is causing these shifts.

    How can these 2 errors be resolved. In wp rocket, under the Preload section, i also added the local URL path of the font that i had installed, i.e. IBM Plex Sans. Also, sometimes, the pagespeed shows only my locally installed fonts under the error and at other times, it shows gstatic fonts also.

    ying

    (@yingscarlett)

    Go to generateblocks > settings, toggle the Disable Google Fonts option.

    If any GB block has the font-family set to Roboto, remove it from the block.

    Thread Starter shreyaam

    (@shreyaam)

    Hey Ying, the Google Fonts are already disabled in the GenerateBlock settings. Still, I am seeing the render blocking issue fpr googleapi: https://fonts.googleapis.com/css?display=swap&family=Roboto%3A300%2C400

    David

    (@diggeddy)

    That screenshot shows the issue is related to the Roboto font – are you loading that in the theme? As I don’t see it.
    Roboto is commonly loaded by Adverts and some other 3rd parties scripts. Which may whats making that request … which the theme has no control over.

    Thread Starter shreyaam

    (@shreyaam)

    Hey David,
    Thanks for replying. I resolved the CLS issue by decreasing the font size; do not know how that worked. Regarding the Roboto font, I got it blocked with the OMGF plugin which detected it in the stylesheet. So, it worked, atleast for now.

    David

    (@diggeddy)

    Glad to hear you got it working !

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