Stuffed Marshmallow Stuffed Marshmallow - 22 days ago 6
CSS Question

Load Google Font with <link> asynchronously or deferred without Font Face Observer

I am wanting to use the Google Font "Noto Serif" for my website.
My problem is that when I test it with Google PageSpeed Insights, it tells me I'm perfect except for one thing:

<link href="https://fonts.googleapis.com/css?family=Noto+Serif" rel="stylesheet">


"Your page has 1 blocking CSS resources. This causes a delay in rendering your page. None of the above-the-fold content on your page could be rendered without waiting for the following resources to load. Try to defer or asynchronously load blocking resources, or inline the critical portions of those resources directly in the HTML."

I am aware of a bad solution for this. It's to link the font using
<script>
at the bottom of the HTML file. The problem with that solution is it causes a Flash of Unstyled Text every time you click on something in my website.

I am using jekyll hosted with GitHub Pages, so I don't think I can install Font Face Observer :(

Answer

Here ya go, include this in the body tag and not the head tag

<link href="https://fonts.googleapis.com/css?family=Noto+Serif" rel="stylesheet" lazyload>