dillonzq / LoveIt

❤️A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题
https://hugoloveit.com
MIT License
3.38k stars 1.07k forks source link

不能修改网站的favicon #755

Open AgentMero opened 2 years ago

AgentMero commented 2 years ago

不能修改网站的favicon

您好,我尝试着替换网站的favicon. 把从realfavicongenerator得到的多个icon相关的文件,放到了

都没有成功替换,还是得到默认的icon。

我尝试着在config.toml中添加

[params.images]
    favicon           = "/images/favicon.png"

或者

   favicon           = "/images/favicon.png"

也没有成功。

请问是哪一步操作错误呢?期待您的答复,谢谢

c2h5oc2h5 commented 2 years ago

我之前也碰到了这个问题,其实是可以修改的,把你从网站上转换的文件解压缩后复制替换到你上面的第一个,也就是博客根目录下的static文件夹里,然后生成博客,离线访问博客地址应该就能看到网站的图标已经改了。我的博客是部署到GitHub上的,需要将生成的博客git到GitHub上以后,在线访问博客才能看到网站图标更改,下面的图片是我更改后的样子。

AgentMero commented 1 year ago

@c2h5oc2h5 非常感谢您的回答。我重新尝试后(https://github.com/AgentMero/blog-hugo.github.io),也去看了您的博客github地址,我们生成的静态网站,这些图片文件最终都在根目录下,但是我这边的还是没有能正确显示

LouiMinister commented 1 year ago

I found Solution

https://stackoverflow.com/questions/16375592/favicon-not-showing-up-in-google-chrome

Clear your cache. http://support.google.com/chrome/bin/answer.py?hl=en&answer=95582 And test another browser.

Some where able to get an updated favicon by adding an URL parameter: ?v=1 after the link href which changes the resource link and therefore loads the favicon without cache (thanks @Stanislav).

<link rel="icon" type="image/x-icon" href="favicon.ico?v=2"  />
Agility6 commented 1 year ago

我刚刚也碰见了(有可能是浏览器的缓存问题,ctrl+f5强制刷新试一试😣