dabadaba
dabadaba

Reputation: 9522

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.

Upvotes: 6

Views: 4911

Answers (1)

Aaron Gray
Aaron Gray

Reputation: 11703

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.

Upvotes: 7

Related Questions