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