Home › Forums › Support › Fonts.gstatic.com – Warnings: Lighthouse was unable to automatically check the `
- This topic has 7 replies, 2 voices, and was last updated 3 years, 3 months ago by Elvin.
-
AuthorPosts
-
January 17, 2021 at 7:52 am #1622490Hemant
Hello Team,
Hope you are doing great.
Just wanted to see if we can do something for this warning from lighthouse.
I ran a speed test on page: https://fatlossplanner.com/boiled-egg-diet/
I get error saying :
“Warnings: Lighthouse was unable to automatically check thefont-display
values for the origin https://fatlossplanner.com.”Is there a way to get rid of this?
The guide here https://web.dev/font-display/?utm_source=lighthouse&utm_medium=unknown says we need to leverage css by using below script.
@font-face { font-family: 'Pacifico'; font-style: normal; font-weight: 400; src: local('Pacifico Regular'), local('Pacifico-Regular'), url(https://fonts.gstatic.com/s/pacifico/v12/FwZY7-Qmy14u9lezJ-6H6MmBp0u-.woff2) format('woff2'); font-display: swap; }
But I am not quite sure if this will work in my case as the font error looks like roboto font.
Plkease help me with either css code or anything we can do at the php side.
Any help is greatly appreciated.
January 17, 2021 at 4:27 pm #1622827ElvinStaffCustomer SupportHi there,
You can add this PHP snippet:
add_filter( 'generate_google_font_display', function() { return 'swap'; } );
This adds
&display=swap
to your google fonts loaded on thewp_head
to address this issue.January 17, 2021 at 5:20 pm #1622845HemantOK so I added this code via php snippets and still get the warning.. š
Here’s the page: https://fatlossplanner.com/boiled-egg-diet/
January 17, 2021 at 8:49 pm #1622946ElvinStaffCustomer SupportOK so I added this code via php snippets and still get the warning.. š
Hereās the page: https://fatlossplanner.com/boiled-egg-diet/
Can you temporarily disable SG Optimizer? To check just incase it’s interfering w/ the script.
Can you tell us how you’re adding the font? I’ve checked the page and it’s doesn’t seem to be adding the google fonts the default way the theme adds in google fonts from the customizer.
Are you manually importing fonts? Let us know.
January 17, 2021 at 9:19 pm #1622967HemantSo I added that code using Code Snippets – https://docs.generatepress.com/article/adding-php/
I have disabled SG Optimizer and cleared the cache.
Still the same..
I am not adding any fonts.. it looks like it’s coming from Google Ads it seems… as I am using system font “Verdana” by default.
January 17, 2021 at 10:29 pm #1622998ElvinStaffCustomer SupportI am not adding any fonts.. it looks like itās coming from Google Ads it seemsā¦ as I am using system font āVerdanaā by default.
Ah that’s actually true as shown here:
https://share.getcloudapp.com/wbuKE2R9I’m afraid this is outside of our scope as we can’t control how ad scripts display their contents.
You’ll have to ask the developer of the plugin or the script you’re using.
January 17, 2021 at 11:07 pm #1623033HemantNever mind… the problem is GTmetrix shows a score of 100 but page speed insight is getting difficult…
Let me know if you have any suggestions…
I will close this thread.. but it will be great if you can suggest something on that.. I tried adding `
January 18, 2021 at 3:46 pm #1624265ElvinStaffCustomer SupportLet me know if you have any suggestionsā¦
As mentioned previously, you can try asking the developer of the plugin or script you’re using for the ads for any suggestions on how to tackle this issue. Perhaps they’ve already encountered this and already provided modifications.
-
AuthorPosts
- You must be logged in to reply to this topic.