Magento 2 Developement

Magento 2: How to add Google Font

You might already check Include static resources (JavaScript, CSS, fonts) article by magento team. They state that to add google font you need to update /Magento_Theme/layout/default_head_blocks.xml with

But as a result it is not working. Correct code is

It wont work without additional parameters.

Google fonts used in our tutorial for Slider Revolution: How to insert HTML slider in Magento 2

Another case is when you want to specify font subset like &subset=latin,cyrillic. The solution is Replacing ampersand in the path with

The problem seems that the xml code is escaped three times. If it does not work for you, try adding or removing the amp; part as many times as needed until it works.
Check github thread for complete information on this issue – https://github.com/magento/magento2/issues/2228

One thought on “Magento 2: How to add Google Font

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.