I am a huge, huge believer in what are called “favicons”. These are the tiny icons that your web application declares to the world:

“here’s a visual representation of this site to use when someone creates a bookmark link to me on their browser link bar”

I know that sounds perhaps beyond nerdy but that’s what they do. I use a LOT of web sites and rely on them constantly so what I do is drag links from them to my browser link bar and when a fav icon exists it means I can use just an icon instead of text. Here is, for right now, what my browser link bar looks like:

browser_link_bar

Here’s how to add a favicon to your Rails app.

  1. Come up with a favicon in either .ico or .png format. I can’t tell you which is better but I know that both of these work.
  2. Place that icon file in app/assets/images
  3. In your application.html.erb template in app/views/layouts you want to add this html snippet:
<%= favicon_link_tag asset_path('favicon.png'), :rel => 'icon', :type =>  'image/png' %>

or

<%= favicon_link_tag asset_path('farmer.ico'), :rel => 'icon', :type => "image/x-icon" %>

Do add / commit / push / deploy dance and check in production

Note 1: Once upon a time you had to always name these favicon.ico but that’s no longer necessary as your html tells the browser what to look for.

Note 2: Helpful Stack Overflow post I cribbed from.