We rebuilt our website from scratch and are still updating some extensions and pages. Having a problem? Sign in and open a support ticket or contact us.
JoomBoost

How it works

Easy Local Google Fonts runs when Joomla has built a front-end page and before the page is sent to the browser. It reads the page's HTML, looks for Google Fonts addresses, and replaces each one it can handle with the address of a local copy.

The order of the checks

On each front-end page the plugin runs up to three checks, in this order. Each has its own switch in the plugin options.

  1. Detect In CSS Files: CSS files of your site that the page links to. See Google Fonts in CSS files.
  2. Detect In HTML Link tags: <link> tags that load a Google Fonts stylesheet.
  3. Detect In HTML Style tags: Google Fonts addresses anywhere else in the HTML.

The plugin looks for <link> tags whose address starts with fonts.googleapis.com/css?family=, /css2?family= or /icon?family=, with https:// or without it (//fonts.googleapis.com/...). The type of link does not matter, so both stylesheet links and preload links are changed. For example:

<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">

becomes a link to a file such as:

<link href="https://www.example.com/media/plg_system_easylocalgooglefonts/fonts/1b5c....css" rel="stylesheet">

Only the address changes. The other attributes of the tag stay as they were.

Addresses in the HTML

The third check looks for any address on fonts.googleapis.com or fonts.gstatic.com in the whole HTML of the page. This catches fonts loaded with @import in a <style> block, or with url() in a style attribute:

<style>
@import url('https://fonts.googleapis.com/css?family=Open+Sans');
</style>

Despite its name, Detect In HTML Style tags is not limited to <style> tags. It also replaces Google Fonts addresses in link tags, scripts and in the text of articles, for example a link to a font stylesheet in a tutorial. See Detect In HTML Style tags.

Font stylesheets from fonts.googleapis.com

For a stylesheet address, the plugin:

  1. Downloads the stylesheet from Google. It asks as a current Chrome browser, so Google sends the stylesheet for modern browsers, which uses WOFF2 font files.
  2. Reads every url(...) in it and downloads each font file into the fonts folder, unless a file with that name is already there.
  3. Changes the url(...) addresses in the stylesheet to the local files and saves the stylesheet in the fonts folder.
  4. Puts the address of the saved stylesheet in the page.

The full Google address is downloaded, so weights, styles and the display value (for example display=swap) are the ones the page asked for. The plugin does not add its own font-display or preload settings.

The saved stylesheet is named after the family value of the address. See What is saved.

Font files from fonts.gstatic.com

Some templates link a font file straight from fonts.gstatic.com, for example in their own @font-face rule. The plugin downloads that file into the fonts folder and replaces the address with the local file.

The first page view

The downloads happen while the server builds the page, the first time a page with that font is shown. That page view takes longer, depending on how many font files the stylesheet lists. Every later page view uses the saved files and only changes the addresses in the HTML.

If a download fails, for example because Google cannot be reached, the plugin keeps the original Google address in the page, so the font still shows. It tries again on the next page view. In 6.0.1 a single font file that fails inside a stylesheet that did download is saved as an empty file. See A font shows in the wrong style or not at all.

Where it runs

  • Only on front-end pages. The administrator is never changed.
  • Not on pages whose view is form, such as front-end edit forms of Joomla and of some page builders. See What is not replaced.

All Extensions