How can I make sure to use this CSS function? Google Pagespeed Insights recommends adding this. Is there a way to add this via custom code?
Just chiming in that I have this question too!
Why not? Just add your properties with any custom code method (for the whole site, for the page, with embed)
For those inquiring minds…
Webflow google font code using js:
Standard google font import code:
<link href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap" rel="stylesheet">
I would also love to know the answer to @Ntchi 's question. Font-display=swap would help my site greatly it seems. Is there a way to directly access the CSS to make sure the swap is in there?
I would also like to know how I can use font-display: swap; with Webflow Font embed.
I’m also curious about this.
I would love to find out this!
Also trying to find a solution to this.
For those that did not visit the link and are asking how to do this with fonts loaded via the webfont,js library that Webflow uses the answer is : TL’DR => you can’t.
The article presents options for you if you want to load the fonts yourself or leverage Cloudflare service workers. Those would be the only two options for Webflow sites hosted on Webflow.
Awesome thanks. New to webflow forum and didn’t see that your previous comment with the link was the solution. Will check it out.
It seems that Webflow implemented “font-display: auto” to its css on hosted as well as on exported sites - wasn’t there a few weeks ago, I always added it manually to exported sites.
You can now edit this value to „swap“, „fallback“, etc when uploading a self hosted font!
I’ve been looking for a solution to this for a while now and this thread keeps popping up in my searches.
I found a way to make this happen for those looking for a no-code work arround. Just follow the steps below.
Download the open source font on Google Fonts
Extract the asset into your local x:/project/fonts/font-name folder
Upload the .TTF asset to font-squirl optimizer
Extract the .woff2 asset
Copy it to your local x:/project/fonts/font-name folder
Upload the assets to Webflow Settings → Font
Define your Font Family, display: swap, and fallback accordingly.
Run your speed test again and measure the improvements.
No more nagging fallback font reccomendation
Now crack open a beer, a soda, some coffee, or tea, take a sip and sigh in relief.
And that folks is the work around to getting Google Fonts to display swap.