How to add favicon?

Sorry to hear it’s no longer working for you!

Did you add all of the files from the example from my post (e.g. apple-touch-icon.png manifest.json browserconfig.xml etc.)? If that’s the case then you would need to include them in your plug Plug.Static:

  plug Plug.Static,
    ...
    only: ~w(... favicon.ico apple-touch-icon.png android-chrome-192x192.png android-chrome-512x512.png favicon-16x16.png favicon-32x32.png mstile-150x150.png safari-pinned-tab.svg manifest.json browserconfig.xml ..)

The manifest.json in my example is the json file that they generate for you and name site.manifest. Then, you need to include this in your appropriate html file:

Note: the + is for reader context (from the version control diff) and is not to be included in your file. Also, you’d need to include all of the favicon related files that you have in your plug Plug.Static in a similar fashion.

I have multiple root layouts that I use in Metamorphic, so I created a _favicon.html file and add all of my favicon related code in that and simply render that file in my layouts (note: this goes in the <head>):

<%= render "_favicon.html", assigns %>

If there’s no issue with any of those suggestions, then I’d defer to @kokolegorille’s advice. :blush:

4 Likes