Favicon with GitHub Pages

I used

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

as well as

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

or

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

None of that worked. Finally I got it working by

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

in fact, seems that any of the above solution with an extra "?" at the end will do the trick.


It also works with favicon.png

  <head>
    ...
    <link rel="shortcut icon" type="image/png" href="favicon.png">
  </head>

The only problem is the slash / in "/favicon.png"

However this does not work for sub-pages!

The link should look like this - so you have the favicon on every page:

<link rel="shortcut icon" type="image/png" 
      href="{{ "/assets/images/favicon.png"  | absolute_url }}">

The resolved URL looks like: https://pme123.github.io/scala-adapters/assets/images/favicon.png

This expects the favicon.png in assets/images folder of your Jekyll project.


Yes, you can.

Put this into the head part of your webpage:

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

It is important to not put the slash before the favicon.ico part. Put the favicon.ico file in your repository's home directory.