Mr_G
Mr_G

Reputation: 131

Do not request https://fonts.gstatic.com

I am trying to speed up my website and want to get rid off some https://fonts.gstatic.com requestes. For instance, PageSpeed Insights gives me a warning about "Make sure all text remains visible while loading the web fonts" about https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2

While gtmetrix is displaying this request instead: https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxK.woff2

Do not know why they are different, but how can I omit this type of request? I can not find these text strings when I search for them in my WordPress public_html directory using SSH.

PageSpeed Insights : enter image description here

Gtmetrix:

enter image description here

Upvotes: 2

Views: 19109

Answers (2)

Kitswas
Kitswas

Reputation: 1197

want to get rid off some https://fonts.gstatic.com requests

If you are using Google Fonts, then you cannot. Gstatic.com is a domain that Google owns and uses to serve static content. See this answer on SuperUser.

PageSpeed Insights gives me a warning about "Make sure all text remains visible while loading the web fonts"

I hope you have read the documentation.
When using Google Fonts, add the &display=swap parameter to the end of the Google Fonts URL.

The good news is, following the instructions on Google Fonts will generally handle things for you. Instructions demo

Continue reading iff the above could not satisfy you

For further speedups and/or customization (e.g. reducing the number of preconnects), this is how I handle the issue.

Suppose I want to use the font Comfortaa.

 <link href="https://fonts.googleapis.com/css2?family=Comfortaa&display=swap" rel="stylesheet"> 

Instead of linking the remote CSS file at https://fonts.googleapis.com/css2?family=Comfortaa&display=swap, I visit the URL, download the CSS file to the server and link to that instead.
This gets rid of the delay caused while establishing connections to fonts.googleapis.com.

Warning:
The CSS files provided by Google Fonts may be changed in future.
It is your responsibility to update those files when modified by Google Fonts.

Upvotes: 1

Tasdemir
Tasdemir

Reputation: 67

can you add this line.

<link rel="preload" as="font" type="font/woff2" href="https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2" crossorigin>

Upvotes: 0

Related Questions