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?

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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