grangerelixx

grangerelixx

How to add favicon?

I have a file called favicon.ico. I would like to know what code goes into this file or any sample code would be appreciated. And how to make this file work?

Most Liked

f0rest8

f0rest8

You can also use something like this site to generate the files for your icons, mentioned in a previous post of mine:

That site has instructions for how to apply them in your code once they are generated and you simply place those generated files in your assets/static location like @APB9785 mentioned. Also, you can reference their instructions with the instructions from this post from @idi527:

Hope that helps in terms of how you make your favicons “work”. :heart:

f0rest8

f0rest8

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:

grangerelixx

grangerelixx

Thank you so much. It worked!!

Where Next?

Popular in Questions Top

WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&amp;query=perfume&amp;page=2, I would like to get: ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41989 114
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 48342 226
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement