I'm hosting a website using Github Pages. I connected Cloudflare to the website because of SSL. When i finally added favicon.ico
to my website and the following code in <head>
to make the favicon show up, it still doesn't show up. What can i do?
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
(english is not my native language)
Edit: Seems like other people can see the favicon, except me. But why?
I have had the exact same problem. I was able to solve it by including a ? in the end.
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico?">
I am not exactly sure why adding in ?
works but the code below does not.
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico?">
Adding a question mark at the end of the path is one workaround.
<link rel="shortcut icon" type="image/png" href="coin.png?">
Try also using a URL from a site that has the image, it might work.
<link rel="shortcut icon" type="image/x-icon" href="./Images/favicon.ico?">
if you did something like this , then go to your github.io page and hard reload. You can use
ctrl/cmd + shift + r
to hard reload the page . That will clear your cache .
如果您已将使用 npm 创建的项目部署到 Github Pages,并且您的构建文件位于单独的子目录中,则您必须像这样定义网站图标的路径(注意点)。
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png">
Add the icon path correctly
<link rel="icon" href="./favicon.ico"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.