2

I have added google font in default_head_blocks.xml file like this:

<link rel="stylesheet" type="text/css" src="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" src_type="url" />

And I am facing an error as per below screenshot: enter image description here

Kindly help me to resolve this error.

2

1 Answer 1

4

Try to use below line in your default_head_blocks.xml file

<link rel="stylesheet" type="text/css" src="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&amp;display=swap" src_type="url" />

There's one & symbol, you can use &amp; instead of & sign in URL, whenever you're trying to insert URLs in XML file.

After changing above line, please try to clear Magento cache using below commands :

php bin/magento cache:clean
php bin/magento cache:flush

Hope this will work for you!

7
  • it's not working dear, I have already try this Commented May 20, 2020 at 13:10
  • @SatishRana, I have tested and it's working for me. Just add link URL inside <head> tag in your default_head_blocks.xml and flush and clear Magento cache. It'll work. Commented May 21, 2020 at 2:41
  • @DipeshRangani, Let me know if it works for you then. Thanks. Commented May 21, 2020 at 4:16
  • 2
    it's working, I have tested again may be it's because of browse cache or deployment issue. Commented May 21, 2020 at 5:07
  • 1
    It's working for me as well Thanks @KishanSavaliya..! Commented May 21, 2020 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.