F
Favicon Generator

Favicon generator for Ruby on Rails

Deploy favicons through the asset pipeline with a reusable ERB partial.

Ruby on Rails

Generate your favicon package first, then follow the steps below to integrate with Ruby on Rails.

Generate favicons

Installation steps

  1. 1

    Extract favicon files to app/assets/images/favicon/ (or public/ for Propshaft-only setups).

  2. 2

    Create app/views/application/_favicon.html.erb with the partial below.

  3. 3

    In app/views/layouts/application.html.erb, add <%= render 'application/favicon' %> inside <head>.

  4. 4

    Precompile assets if using the asset pipeline: rails assets:precompile.

  5. 5

    Verify /favicon.ico in production after deploy.

Code & configuration

Copy and adapt for your Ruby on Rails project

<%# app/views/application/_favicon.html.erb %>
<%= favicon_link_tag 'favicon/favicon.ico', rel: 'shortcut icon' %>
<%= favicon_link_tag 'favicon/favicon-96x96.png', rel: 'icon', type: 'image/png', sizes: '96x96' %>
<link rel="icon" type="image/svg+xml" href="<%= asset_path 'favicon/favicon.svg' %>" />
<link rel="apple-touch-icon" sizes="180x180" href="<%= asset_path 'favicon/apple-touch-icon.png' %>" />
<link rel="manifest" href="<%= asset_path 'favicon/site.webmanifest' %>" />

Pro tips

  • For Rails 7+ with Propshaft, placing files in public/ is often simpler.
  • Use asset_path helpers so fingerprinted assets resolve correctly.

Files to deploy

favicon.ico
favicon.svg
favicon-96x96.png
apple-touch-icon.png
android-chrome-192x192.png
android-chrome-512x512.png
site.webmanifest