how to add favicon with symfony 6

Viewed 50

Good morning to you all,

I'd like to ask you for help because I don't understand where my problem with adding a favicon with Symfony 6 comes from.

I have two codes in mind, this one

<link rel="icon"
      href="{{ '/images/' ~ 'favicon.jpg' }}"
      type="image/x-icon"
      src="" />

as well as this one

<link rel="icon"
      href="{{ asset('/images/' ~ 'favicon.jpg') }}"
      type="image/x-icon"
      src="" /> 

None of the codes work.

I even get this error in Symfony when I put assets in my code, and I use yarn.

An exception has been thrown during the rendering of a template ("Asset manifest file "C:\wamp64\www\projet-conrad-angela/public/build/manifest.json" does not exist. Did you forget to build the assets with npm or yarn?").
<link rel="icon"
      href="{{ asset('/images/' ~ 'favicon.jpg') }}"
      type="image/x-icon"
      src="" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}

If you have a solution, I would be delighted to help. Thank you.

1 Answers
Related