How do you add a favicon to a GitHub page with a theme? #23990
-
I’m trying to add a favicon to a GitHub page with the ‘slate’ theme but I don’t know where to add it as it doesn’t use traditional html. |
Beta Was this translation helpful? Give feedback.
Replies: 19 comments
-
It must not require terminal. |
Beta Was this translation helpful? Give feedback.
-
Hey @mcloverz, Once you have generated the theme, then naviagate to the root directory, you will find an index.html file in your root directory. after that i believe it should be very straight forward, just add a simple link tag like you would add in your normal static html website. But just be sure not to put a slash in the beginning when defining the href attribute. so for example
this assumes you are placing the .ico file in the root directory, if not then,
hope this helps you :slight_smile: P.S: for assurance purposes i did google what your query was exactly, linking the source from where i got the exact details: The Link |
Beta Was this translation helpful? Give feedback.
-
Thanks! I’ll give it a try. |
Beta Was this translation helpful? Give feedback.
-
This still doesn’t work as I am using a theme (index.md), not HTML (index.html). |
Beta Was this translation helpful? Give feedback.
-
Nevermind, I figured it out! I’ll accept your answer as the solution as it’d probably help most. |
Beta Was this translation helpful? Give feedback.
-
How do you do it |
Beta Was this translation helpful? Give feedback.
-
May I know how did you solve this? I’m asking because I also have an index.md file. |
Beta Was this translation helpful? Give feedback.
-
You can just drag and drop the favicon.ico file into your repository and it’ll work, might need to give it a few minutes to update :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
I was not able to make this work with the Minimal theme - I tried everything suggested here! I have my favicon saved in my repo as both a .ico and .png file. I also tried adding this code to the top of my index.md file:
(It works fine when I create an index.html file, but of course that doesn’t work with the theme.) I also tried adding this to my _config.yml file:
Can anyone help me figure out what I’m doing wrong? EDIT: I realized today that this is a Mac issue (Chrome and Safari). On my work PC, the favicon shows up as it should. |
Beta Was this translation helpful? Give feedback.
-
What was the solution? Have been searching for a while, and tried a number of things, but am still unable to figure it out. |
Beta Was this translation helpful? Give feedback.
-
I am also using
2. Go to
into the
|
Beta Was this translation helpful? Give feedback.
-
How did you manage to solve it? |
Beta Was this translation helpful? Give feedback.
-
Following the advice of @chengchou helped me a lot, even though I had no _layouts/ to start with. All I had to do was add a /_layouts/default.html with this code:
and it displayed my favicon. |
Beta Was this translation helpful? Give feedback.
-
I tried this. Didn’t work. |
Beta Was this translation helpful? Give feedback.
-
I tried chengchou’s solution and it didn’t work at first. For some reason it started working when I used a .png file instead of .ico. Worth a try for anyone having troubles! So: |
Beta Was this translation helpful? Give feedback.
-
Favicon with github pages - #4 by timrossback tells how to solve this. |
Beta Was this translation helpful? Give feedback.
-
Does anyone know how to get this to work on the Modernist theme? |
Beta Was this translation helpful? Give feedback.
-
Hi this answer might be bit late, but free feel to try this out, this is the closest can get with shield.io Type this on the index.md file |
Beta Was this translation helpful? Give feedback.
-
None of this works.. |
Beta Was this translation helpful? Give feedback.
Hey @mcloverz,
Once you have generated the theme, then naviagate to the root directory, you will find an index.html file in your root directory.
after that i believe it should be very straight forward, just add a simple link tag like you would add in your normal static html website.
But just be sure not to put a slash in the beginning when defining the href attribute.
so for example
this assumes you are placing the .ico file in the root directory, if not then,
hope this helps you :slight_smile:
P.S: for assurance purposes i did google w…