Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 11

How do you add a favicon to a GitHub page with a theme?

Solved! Go to Solution.

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.

10 Replies
Highlighted
Copilot Lvl 3
Message 2 of 11

Note:

It must not require terminal.

Highlighted
Solution
Copilot Lvl 3
Message 3 of 11

Re: How do you add a favicon to a GitHub page with a theme?

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

<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">

this assumes you are placing the .ico file in the root directory, if not then,

<link rel="shortcut icon" type="image/x-icon" href="whatever_folder_name/favicon.ico">

hope this helps you :)

 

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

Highlighted
Copilot Lvl 3
Message 4 of 11

Re: How do you add a favicon to a GitHub page with a theme?

Thanks! I'll give it a try.

Highlighted
Copilot Lvl 3
Message 5 of 11

Re: How do you add a favicon to a GitHub page with a theme?

This still doesn't work as I am using a theme (index.md), not HTML (index.html).

Highlighted
Copilot Lvl 3
Message 6 of 11

Re: How do you add a favicon to a GitHub page with a theme?

Nevermind, I figured it out! I'll accept your answer as the solution as it'd probably help most.

Highlighted
Ground Controller Lvl 1
Message 7 of 11

Re: How do you add a favicon to a GitHub page with a theme?

How do you do it

Highlighted
Ground Controller Lvl 2
Message 8 of 11

Re: How do you add a favicon to a GitHub page with a theme?

May I know how did you solve this? I'm asking because I also have an index.md file.

Highlighted
Ground Controller Lvl 1
Message 9 of 11

Re: How do you add a favicon to a GitHub page with a theme?

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 :)

Highlighted
Copilot Lvl 2
Message 10 of 11

Re: How do you add a favicon to a GitHub page with a theme?

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: 

<link rel="icon" href="/favicon.ico" type="image/x-icon" />

 

(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:

site_favicon: favicon.ico

 

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.