Search code examples
javascriptcssfont-awesomepagespeedgoogle-pagespeed

Font-awesome CDN JS showing as render-blocking on Pagespeed Insights


Instead of directly linking to the Font Awesome CSS, I am using the js from Font Awesome CDN to allow async loading of the icons on the homepage but Google's Pagespeed Insights still marks it as a render-blocking js.

I am using the custom js link provided by Font Awesome CDN and putting it in the <head> section (I could put it towards the end of the <body> also but thats where Font Awesome CDN asks me to put it).

<script src="https://use.fontawesome.com/mycustomcode.js"></script>

And yes, I have turned on Async loading by logging into my account on Font-Awesome-CDN.


Solution

  • As mentioned in @GramThanos's comment, everything inside the <head> is render-blocking. Font-awesome CDN makes the CSS load asynchronously which does speed it up but Google would still see the JS as render-blocking.

    Moving the JS near the end of the <body> helped it to not be render-blocking and also get rid of the PageSpeed Insights warning.