How to add favicon in laravel
In general you need to do something like this in your <head> </head> tags in HTML
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
You can use this site to generate your favicons: https://favicon.io/
Also, "not working" is not really helpful if you have a question... Please be more specific. Tell us what you tried and what part is not working ;)
This was helpful, thanks.
i have included code but why my code is removed
I don't know... Anyway did you get it all working now?
Please format your code by putting 3 backticks ``` on a line before and after each code block
You should put it into the public directory and reference to it with following code:
<link rel="icon" href="{{ URL::asset('favicon.ico') }}" type="image/x-icon"/>
This one worked for me. I couldn't get Snapey's suggestion to work on the server.
In Laravel 8, I must to add my favicon in a folder inside /public root directory. Then I use this tag in blade view:
<link rel="shortcut icon" type="image/x-icon" href="{{ asset('img/favicon.ico') }}">
@entoniperez In general, best practices is always put favicon-related files in the root directory (site/public). Not nested within another directory.
@webrobert For sure you are right, but it doesn't work if I put the favicon in the root directory. I don't know why...
@entoniperez What does your URL look like for your homepage?
My favico not show with this code inside my master.blasde.php:
i'm using laravel module nwidart
This worked for me:
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="{{ asset('favicon.ico') }}">
with *.ico placed in public (not in folder within public)
Thank you everyone for the info above...
Please or to participate in this conversation.