Self-Host Google Fonts
Protostar loads the Google Fonts from Google servers by default. In terms of data protection law, this is often viewed critically in the EU (see also GDPR). Alternatively, you can also integrate the Google Fonts locally and load them from your own server. Only 2 steps are necessary for this:
- Select, download and integrate Google Font
- Disabling of the old references
Note:
It is possible that you are working with a copy of the Protostar template. In this case, adapt the template name accordingly in the following instructions!
Instead of /templates/protstar/ you then use, for example /templates/copy-protostar/ !
1. Select, download and integrate Google Font
Go to the following website: https://google-webfonts-helper.herokuapp.com/fonts
Select a Google Font with the desired charset and style, e.g. "Open Sans" !
- Download the associated file (zip) and unzip it into the following directory: /templates/protostar/fonts
The "fonts" directory must be created beforehand, as it normally does not exist. - Copy the associated CSS code into the user.css of the Protostar template using "Copy & Paste"! If necessary, adjust the paths to the Google Font files in the CSS code, which are located in the "fonts" directory. Now these should be found.
2. Disabling of the old references
In order to avoid the connection to Google servers, the previous references must now be deactivated or removed. To do this, the index.php in the Protostar template must be edited.
/templates/protostar/index.php
The easiest way is to put line 52 as a comment:
Original:
JHtml::_('stylesheet', 'https://fonts.googleapis.com/css?family=' . $font);
New:
/* JHtml::_('stylesheet', 'https://fonts.googleapis.com/css?family=' . $font); */
Alternative
There is a Joomla plugin that can remove all external links to "Google Font Servers", added by the template or an extension:
JMG Disable Google Font