2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ASP .NET Core Tips - faviconの作成

Last updated at Posted at 2020-05-12

概要

ASP .NET CoreでWebアプリを開発している中で、
favicon作成にサービスを利用したので、その備忘録。

使用したサービス

そのまんまのサービス名ですが
Favicon Generator for ASP.NET Core
というサービスを利用しました。

前提

・faviconにしたい元画像データがあること
・wwwroot直下にfaviconを配置する

使い方

  1. サイトを開いたら、「Select your Faicon Image」をクリック
    image.png

  2. ファイル選択ダイアログが表示されるので、元画像データファイルを選ぶ

  3. 元画像のサイズが小さいと、以下のようなダイアログが表示されますが、「Continue with this picture」をクリック
    image.png

  4. 以下のような画面が表示されます。画像にマージンを付けたり、そのマージンを角丸にしたり、色を付けたりできます。任意の設定をしてください。
    image.png

  5. 画面を下までスクロールして、「Generate your Favicons and HTML code」をクリック
    image.png

  6. 以下のような画面が表示されます。「Favicon package」をクリックして、Zipファイルをダウンロードします。
    image.png

  7. ダウンロードしたZipファイルを展開し、中身をASP .NET CoreのWebアプリプロジェクト内wwwrootフォルダ直下に置きます。

  8. _Layout.cshtmlを開き、headタグ内に以下のコードを追加します。

_Layout.cshtml
    <link rel="shortcut icon" type="image/x-icon" href="~/favicon.ico">
    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
    <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">

※ここでは、faviconとiPhone/iPadのホーム画面用アイコン(apple-touch-icon.png)のみ設定しています。

9. デプロイして、faviconが表示されることを確認してください。

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?