How to Load Google Web Font Asynchronously?

Learn trick to load Google web Font Asynchronously And overcome from render Blocking CSS.

7
data:blog.title
Google Font

Text is the main part of any website. Because we express our thought, opinions, ideas almost everything in written form by using text. And for writing text we use different Fonts.  Every blogging platform has its own font library which serves to their website while loads. Similarly Google Blogger has also a set of default font which loads each time with a BlogSpot site. But we should know what the defaults Font of Google Blogger are?
  • Arial
  • Courier
  • Georgia
  • Impact
  • Times New Roman
  • Trebuchet
  • Verdana
If you are using any font from above then this tutorial or trick is not necessary for you.  Because my main aim is to improve the web fonts loading time in Blogger template.

Google has a rich Font library and you can use any Font which is hosted on their site. For using Google’s web font please visit the below URL.
  • https://www.google.com/fonts


Why we should use Asynchronous Font?

You would see many fonts in Google Font library. But if you want to use any font then it will create a Font CSS file for your web site. Suppose you want to use Oswald or Roboto or Montserrat then you must add a Font URL from Google font library. And this Font URL affects the Blog loading speed. Because Font file contain small property which needs small data to load. For this reason our site become little slower.

When a Font URL from Google Font library loads on a site then that Font file serve as synchronous script. For this reason this affects loading speed. So in this tutorial I will show you how to load Google Fonts or any other Fonts Asynchronously.

google page speed inside

In addition, Font file is a render blocking CSS which always loads above the fold of a template site. So we must use Asynchronous Font for improving our website loading speed.

How to make Synchronous Font Asynchronous?

This is the main part of this tutorial. This is not possible to use Asynchronous Font directly because Google’s Font is still serving synchronous way and it is also treating as render blocking CSS. But we can turn it into Asynchronous form, to do this just follow the below steps.

Step 1 Log in to your Blogger Account and Go to your Blogger Dashboard

Step 2 Click on -> Template -> Edit HTML->

Step 3 Now find the Font file like below
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'/>
Your Blogger template may contain different Font. For example purpose I have used Oswald Font. So search only http://fonts.googleapis.com/css?family then you will find your Font URL.

Step 4 After finding the Font please move it in a text editor like notepad.

Step 5 Now copy the script from below and Paste it above/before closing head </head> of your site.

<script> 
// <! [CDATA [ 
function loadCSS (e, t, n) { "use strict"; var i = window.document.createElement ( "links"); var o = t || window.document.getElementsByTagName ( "script") [0]; i.rel = "stylesheet"; i.href = e; i.media = "only x"; o.parentNode.insertBefore (i, o); setTimeout (function () {i.media = n || "all"})} 
loadCSS ( "PASTE YOUR FONT URL HERE"); 
//]]> 
</ script>

Customization

  • Please replace the text PASTE YOUR FONT URL HERE with your Google Font file from text editor (Notepad).
Step 6 Finally click Save template button from the top of the screen.

In many Blogger template using multiple template and in this case you can use below script.

<script> 
// <! [CDATA [ 
function loadCSS (e, t, n) { "use strict"; var i = window.document.createElement ( "links"); var o = t || window.document.getElementsByTagName ( "script") [0]; i.rel = "stylesheet"; i.href = e; i.media = "only x"; o.parentNode.insertBefore (i, o); setTimeout (function () {i.media = n || "all"})} 
loadCSS ( " PASTE FONT1 URL HERE"); loadCSS ( " PASTE FONT2 URL HERE "); loadCSS ( " PASTE FONT3 URL HERE" ); 
//]]> 
</ script>

Customization

  • Please replace the text PASTE FONT1 URL HERE, PASTE FONT2 URL HERE and PASTE FONT3 URL HERE with your Google Font file from text editor (Notepad). 
  • If you are using 4 Font file then just add an extra line loadCSS ("PASTE FONT4 URL HERE"); in above script.
This is really simple. After adding the Asynchronous Font script first check your Site that Fonts are loading perfectly or not? If everything is loading smoothly then for checking render blocking CSS file please visit Google page speed inside to test your Blog and see the test result.
  • https://developers.google.com/speed/pagespeed/insights
Now your Font file is not listed as render blocking CSS. Now your site will load faster than before and also it won’t block page rendering process while loads on browser.  I hope you would understand the process. And able to make your Blog smoother and faster than before.
How to Load Google Web Font Asynchronously?
4 Stars stars - "How to Load Google Web Font Asynchronously?" Text is the main part of any website. Because we express our thought, opinions, ideas almost ev...

Post a Comment

Brother, I've seen a new look of your site. Your post title is used as uppercase. If I want to add this fature then what will I do for adding this fature like you?

Please find the below line

.item h1.post-title,.static_page h2.post-title,.error_page h2.post-title,.error-custom h2

now add text-transform:uppercase; after second bracket. But your text size will increase. It will look odd. so decrease the text size also.

vai, kaj hosce na, second bracket er age pore sob jaygatei diye dekheci. ekhon ki korbo?

First you need to understand the CSS scrip. otherwise you won't able to customize template.

.titlex{text-transform:uppercase;}

add this above closing bskin.

Sir Blogger Lab Full Width V1.1 Responsive Template এ POPULAR Tab এর পাসে sidebar-commentsx1
এর অখান কমেন্ট শো করে না ...। কি করতে পারি ...।

Template er folder a "Documentation" name file ace ooitate details code deya ace.ooi code add korlei comment show korbe.

vai, template ta check kore den kaj hosce na keno, apnar mail a send kore diyeci.

Facebook Group Community Disqus Channel Code ConverterHide Code Converter Show EmoticonHide Emoticon

Got questions? Ask ’em below! While we’re here, you might like to give any feedback about this Post, Your comment inspire us to continuous Improvement of This Blog and Contents. Your words are your own, so be nice and helpful if you can. Please, only use your REAL NAME, not your business name or keywords. Using business name or keywords instead of your real name will lead to the comment being deleted. Anonymous commenting is not allowed either. Limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

Make sure you tick the Notify Me box below the comment form to be notified of follow up comments and replies. Thank you for commenting

Contact Form

Name

Email *

Message *