Host locally Google Fonts on the Ex2 theme
Building a beautiful website is very important, but so is the performance of your website. Ex2-Theme is recognized as a fast theme with clean code and optimized for performance that results in fast loading of websites.
Nevertheless, there are additional features you could use on your website that will all have an impact on performance.
Under the Performance option on the Ex2-Theme dashboard (Ex2-Theme > Settings > Performance on the WordPress dashboard), you will find an option to enable local loading of Google Fonts.
By activating this option, you download Google fonts and save them to your web server. This can be a good way to improve the speed of your website.
When you use a Google font on your site, a query must be sent to Google to load that font each time a page or message is loaded. This delay can affect loading speed and performance.
To avoid this, Ex2-Theme comes with a built-in self-hosted feature for Google Fonts. This handy feature was added with the Ex2-Theme 3.6.0 update.
In the Ex2-Theme dashboard, you will find a toggle button to easily enable the Load Google Fonts Locally option.
Enabling this feature will only send one Google Font API request. It will collect all files and data from Google fonts and store them locally on your server. For any subsequent requests, Google fonts will be loaded using locally stored files (until this option is enabled).
Once your font files are loaded locally, you can also preload them. By default, web browsers wait to start displaying content on the user’s screen to load the font file.
In some cases, a browser may be ready to load text from your websites, but have to wait for the font file to be downloaded first and not yet available. This type of situation slows down the loading of your page and creates a bad user experience.
Pre-loading fonts tells the browser to import the font immediately. Thus, the font is ready to be displayed as soon as the browser starts loading the text. This will have a positive impact on the performance of your website.
When fonts are loaded and saved locally, changes to Google Fonts are not automatically applied. To keep your website fonts up to date, Ex2-Theme includes a feature to update locally stored fonts. This produces the following actions:
Your website will automatically update all your policies monthly
The settings will remember the changes you save in the theme customization.
If necessary, you can update the fonts manually at any time by clicking the Purge local font cache button.
Nevertheless, there are additional features you could use on your website that will all have an impact on performance.
Under the Performance option on the Ex2-Theme dashboard (Ex2-Theme > Settings > Performance on the WordPress dashboard), you will find an option to enable local loading of Google Fonts.
By activating this option, you download Google fonts and save them to your web server. This can be a good way to improve the speed of your website.
Local loading of Google Fonts
When you use a Google font on your site, a query must be sent to Google to load that font each time a page or message is loaded. This delay can affect loading speed and performance.
To avoid this, Ex2-Theme comes with a built-in self-hosted feature for Google Fonts. This handy feature was added with the Ex2-Theme 3.6.0 update.
In the Ex2-Theme dashboard, you will find a toggle button to easily enable the Load Google Fonts Locally option.
Enabling this feature will only send one Google Font API request. It will collect all files and data from Google fonts and store them locally on your server. For any subsequent requests, Google fonts will be loaded using locally stored files (until this option is enabled).
Preload local fonts
Once your font files are loaded locally, you can also preload them. By default, web browsers wait to start displaying content on the user’s screen to load the font file.
In some cases, a browser may be ready to load text from your websites, but have to wait for the font file to be downloaded first and not yet available. This type of situation slows down the loading of your page and creates a bad user experience.
Pre-loading fonts tells the browser to import the font immediately. Thus, the font is ready to be displayed as soon as the browser starts loading the text. This will have a positive impact on the performance of your website.
Clear local font cache
When fonts are loaded and saved locally, changes to Google Fonts are not automatically applied. To keep your website fonts up to date, Ex2-Theme includes a feature to update locally stored fonts. This produces the following actions:
Your website will automatically update all your policies monthly
The settings will remember the changes you save in the theme customization.
If necessary, you can update the fonts manually at any time by clicking the Purge local font cache button.
Updated on: 29/03/2023
Thank you!