2

Here I am making my own theme and I want to add font-awesome external URL. I have created a file in my custom-theme directory in the path

app/design/frontend/vendor/theme_name/Magento_Theme/layout/default_head_blocks.xml.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <head>
 <link rel="stylesheet" type="text/css" src="https://use.fontawesome.com/releases/v5.7.2/css/all.css"
 integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous" src_type="url" />
 </head>
</page>

I am following this link https://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html

But after clearing the cache, I could not find the font-awesome link in the view source.

Please guide me. How to fix this issue?

fmsthird
4,6224 gold badges18 silver badges42 bronze badges
asked Mar 13, 2019 at 16:56

1 Answer 1

1

Try This :-

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <head>
 <css src="https://use.fontawesome.com/releases/v5.7.2/css/all.css" type="text/css" src_type="url"/>
 </head>
</page>

Then run php bin/magento cache:flush

answered Mar 14, 2019 at 5:23
3
  • No. it is not working. Any other solution . @Ronak Rathod Commented Mar 14, 2019 at 8:39
  • In browser press ctrl + u and see your css load or not ? Commented Mar 14, 2019 at 8:44
  • Yes I did that my css load but font awesome was not loaded. Commented Mar 14, 2019 at 8:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.