problem with favicon on the blazor site

Saeed Pooladzadeh 231 Reputation points
2022-11-24T11:20:58.617+00:00

Hello,

I have made a site in blazor server.
Why is my favicon not displayed on the site, while when I run it in VisualStudio, it is displayed without any problem?

263874-bla.png

thanks

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,075 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,349 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,218 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Saeed Pooladzadeh 231 Reputation points
    2022-11-24T13:51:46.737+00:00

    As you can see favicon is in the wwwroot folder:

    263898-bla3.png

    On this page:
    https://www.daveabrock.com/2020/11/08/blast-off-blazor-update-head/
    There is a content:

    Now, we can head over the RealFaviconGenerator site to upload our new icon. After adjusting any settings to our liking, it’ll give us a bunch of icons, which we’ll unzip to the root of our wwwroot directory.

    In index.html in the wwwroot directory, add the following inside the <head> tag:

    <link rel="apple-touch-icon" sizes="76x76" 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">  
    <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">  
    <meta name="msapplication-TileColor" content="#da532c">  
    <meta name="theme-color" content="#ffffff">  
    

    Do you mean this?
    If not, can you explain?

    1 person found this answer helpful.

  2. Timo Kinnunen 126 Reputation points
    2023-05-29T18:17:49.37+00:00
    Blazor web app
    
    create a my-logo.svg-file from your my-logo.png-file (1000 pixels x 1000 pixels or less)
    
    copy it here:
    <head>
    ...
    	<link rel="icon" href="images/my-logo.svg">
    </head>
    
    
    1 person found this answer helpful.

  3. Saeed Pooladzadeh 231 Reputation points
    2022-11-24T12:09:18.103+00:00

    Can you please explain about <link> element?
    You mean what should I do?

    I just replace the new favicon with the blazor default one.

    263924-bla1.png

    0 comments No comments

  4. AgaveJoe 25,851 Reputation points
    2022-11-24T12:39:18.957+00:00

    Your responses are not clear.

    The browser looks for favicon.ico in the application root which is the wwwroot folder not wwwroot/site_icons.

    Did you added a link element or changed how the static file handler works?

    Also, you tagged this question as MVC and Web API but your question states this is a Blazor application.

    0 comments No comments

  5. Ugur Ozyildiz 0 Reputation points
    2024-03-13T07:53:20.5466667+00:00

    Thank you, the problem is fixed.

    0 comments No comments