Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 4: favicon not showing

My favicon just won't show, in Chrome or Firefox. This is how I am rendering it in the <head> section:

<%= favicon_link_tag 'favicon.ico' %>

It is located in public/images.

This is the produced HTML:

<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico">

Opening the link in my browser shows the icon correctly.

like image 219
dabadaba Avatar asked Jul 28 '15 20:07

dabadaba


1 Answers

The favicon is not handled by the asset pipeline when its in the public folder, and this can cause caching problems.

See here: How to add favicon in rails 3.2 and Clear the cache from the Rails asset pipeline.

Use the favicon_link_tag and place the .ico file in /app/assets/images/ to get it into the asset pipeline.

If it still doesn't work after that, try clearing your browser cache, your rails cache, and restarting your rails server.

like image 110
Aaron Gray Avatar answered Oct 25 '22 19:10

Aaron Gray