[RUBY] Steps to set a favicon in Rails


About this article
I wanted to add a favicon while making my own app, and it was surprisingly easy, so I will post it as a memorandum!

[environment] ・ Ruby 2.6.5 Rails 6.0.0 ・ MacOS

First of all, let's prepare an image for favicon as a preliminary preparation! Preparation is optional, but I personally recommend the following sites because they are easy to make.

・ Let's make a favicon.ico! (Https://ao-system.net/favicon/) ・ Icons8 | Icon free download (https://icons8.jp/icons/set/favicon)

① Set up a favicon.ico file under assets/assets/images

assets/assets/images/favicon.ico

② Describe the following in "app/views/layouts/application.html.erb" to read the favicon

<html>
  <head>
<!--(abridgement) -->

    <%= favicon_link_tag('favicon.ico') %>

<!--(abridgement) -->
  </head>

③ Restart the local server

$ bundle exec rails s

That's it!

Recommended Posts

Steps to set a favicon in Rails
[Rails 6] How to set a background image in Rails [CSS]
How to insert a video in Rails
Convert to a tag to URL string in Rails
How to implement a like feature in Rails
How to easily create a pull-down in Rails
How to make a follow function in Rails
How to set the display time to Japan time in Rails
How to implement a like feature in Ajax in Rails
I want to use a little icon in Rails
Throw raw SQL to a read replica in Rails
[Ruby / Rails] Set a unique (unique) value in the class
Steps to set up a VNC server on CentOS 8.3
[How to insert a video in haml with Rails]
How to write a date comparison search in Rails
I want to define a function in Rails Console
[Rails] How to load JavaScript in a specific view
A series of steps to create portfolio deliverables with Rails
How to display a graph in Ruby on Rails (LazyHighChart)
Establish a search bar in Rails ~ Join multiple tables to search
Super easy in 2 steps! How to install devise! !! (rails 5 version)
Apply CSS to a specific View in Ruby on Rails
How to set up a proxy with authentication in Feign
Preparing to create a Rails application
[Rails] How to write in Japanese
Create a new app in Rails
Implement a contact form in Rails
How to introduce jQuery in Rails 6
How to set Lombok in Eclipse
How to install Swiper in Rails
[Rails] A simple way to implement a self-introduction function in your profile
How to rename a model with foreign key constraints in Rails
Steps to build a Ruby on Rails development environment with Vagrant
How to implement search functionality in Rails
How to change app name in rails
How to use custom helpers in rails
[rails] How to configure routing in resources
Notation to put a variable in a string
[rails] How to create a partial template
How to implement ranking functionality in Rails
How to publish a library in jCenter
How to use credentials.yml.enc introduced in Rails 5.2
Steps to Use JConsole in Cognos Analytics
Change from SQLite3 to PostgreSQL in a new Ruby on Rails project
[Rails] I want to send data of different models in a form
How to implement a slideshow using slick in Rails (one by one & multiple by one)
[Rails] How to log in with a name by adding a devise name column
Minimal steps to set up a Ruby environment with rbenv on Ubuntu 20.04
Define a task to ZIP archive a set of project files in Gradle
Set up a Java GUI in a separate thread to keep the main
[Order method] Set the order of data in Rails
Rails: How to write a rake task nicely
[Rails] How to write when making a subquery
[Rails] Various ways to write in seed files
[Rails] rails new to create a database with PostgreSQL
[Rails] How to create a graph using lazy_high_charts
I tried to organize the session in Rails
How to display a web page in Java
[Rails] How to use select boxes in Ransack
[Rails / JavaScript / Ajax] I tried to create a like function in two ways.
Add a tag function to Rails. Use acts-as-taggable-on