One of the advantages of hosting fonts on your blog is that you have full control over them, you can reduce those requests and therefore the loading time and decide how to serve them. The best thing to do is not to go crazy and use one or two font families, at most.
For starters, you can save at least two requests to fonts.googleapis.com: the one for the font and the one for the stylesheet. Although Google originally served them quite well from their CDN, this has changed over time and there is a lot of room for improvement by hosting them on your site.
With one click
One of the interesting new features that was added to version 1.7.4 of Perfmatters released on 7 June, is the ability to host Google Fonts on your server with one click
There are other ways to do this, either manually (much more cumbersome) or with a plugin (which doesn’t always work), but Perfmatters, besides saving you this and other plugins, simplifies and automates the task as much as possible. One click and it’s done.
The function automatically locates any Google Font references that exist on your blog, downloads the fonts from fonts.google.com and hosts them locally in the directory: /wp-content/cache/perfmatters/your-domain.com/fonts/
The fonts will be downloaded to that folder out of the box the first time you visit any page of your blog after enabling the feature.
It also creates the corresponding local CSS stylesheets for each font in the same directory. So no more DNS requests to Google.
Just check the checkbox, verify that the files have been created in that path and verify that they are being used.
Perfmatters deserves a full review, it is a payment plugin that is i never tire of recommending is indispensable. It offers powerful support that you can use alongside any other caching plugin. It’s a performance-enhancing, so-called “tweaking” plugin (nothing to do with dancing with your ass).
In addition to its “battle” options, it has a script manager that is worth the small cost of the plugin, you can get it from just 21€ for one site
Its “Script Manager “allows you to control the scripts that load other plugins throughout the site to avoid unnecessary requests and decide where you don’t want them to load to significantly reduce the loading speed. All their functions are well documented on their page.
1 thought on “Host and serve Google Fonts locally in WordPress with Perfmatters”
Another interesting plugin for image optimization: https://wordpress.org/plugins/optipic/ Its automatic convert image to Webp (for webp-supported browsers) and compressed/optimized png/jpeg (for webp-unsupported browsers).
Comments are closed.