How to make load of google font be lazy?

We have a stupid government that blocks google services whenever something happens :man_facepalming: .
Today I realized that my forum was loading very slowly (blank page for about 10 seconds or more). Then I realized that there is a request to google fonts in the header, and its not lazy load. So it waits until it gives timeout and then the forum would load.

How can we make this request lazy?

1 Like

Can you try using the core site setting for fonts? I believe that one does not use Google Fonts at all, so the request will be local, and therefore should be much faster for you.

2 Likes

its already using core site settings.

1 Like

It looks like the font causing the issue is Roboto, and your site settings are set to use Arial… so the font is likely coming from a theme.

You can remove the include that’s reaching out to Google’s servers from the theme and switch to using Roboto from your site settings. You can alternatively download Roboto and include it as a theme asset. We have a guide for creating a theme component with a locally served font here: Create and share a font theme component

You can also try adding font-display: swap; to your @font-face rule: `font-display` for the Masses | CSS-Tricks - CSS-Tricks

4 Likes