Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Favicon with Meteor?

I'm trying to load a favicon into my Meteor project but I can't get it to work. I tried using this tutorial but when I put the mentioned reference in the of my HTML nothing happened. Also what do they mean by /public directory? I don't have a /public directory, should I just put my favicon.ico in the root directory?

like image 649
5AMWE5T Avatar asked Jan 10 '23 21:01

5AMWE5T


2 Answers

The public directory doesn't exist by default - you just need to create it. Meteor uses the public directory in the root of your app to serve plain files rather than bundling them in the app. In order for a <link rel="icon"> tag to work, it needs to point to a file that exists in public. Note that the URL to the icon will not contain the path "public/" - files in public are served as if they were at the root of your web server.

A new Meteor app doesn't include any folders except the required .meteor directory. However, it will treat folders named public, private, client, server, and lib specially. You can also create more arbitrarily named directories. This affords you a lot of control over the exact structure of your app. Read about the Meteor directory structure in the Documentation:

Lastly, the Meteor server will serve any files under the public directory, just like in a Rails or Django project. This is the place for images, favicon.ico, robots.txt, and anything else.

like image 51
sbking Avatar answered Jan 21 '23 20:01

sbking


  1. Create client/header.html: <head><link rel='icon' href='/favicon.ico'></head>
  2. Put you favicon.ico into /public folder.
  3. Start server, open your browser and see the result.
like image 23
haotang Avatar answered Jan 21 '23 22:01

haotang