1
0

More than 3 years have passed since last update.

【Rails】favicon設定手順メモ〜

Posted at

目標

faviconの設定

環境

rails: 6.1.3
ruby: 3.0.0
mac: os

準備

1.favicon用の画像を準備します。

自分が使用した、サイトを貼り付けておきます。
Faviconアイコン -無料ダウンロード

実装

1. ダウンロードしたfavicon画像をassets/images配下にファイルを設置します。

app/assets/images/favicon.png

2.layouts/application.html.erbに記述

app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
  <head>
    <title>SAMPLE</title>
    <%= favicon_link_tag('favicon.png') %>
  </head>
</html>

favicon_link_tagで記述します。
ローカルサーバーを起動して確認、タブが指定したfaviconで表示されます。

まとめ

簡単な作業ですがFavarit iconはユーザーの印象に残る大事なアイコンなので備忘録として残しておきます。

参考

favicon設定 Rails

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0