favicon not updating
Answered
! priyansh ★ posted this in #help-forum
when deploying my nextjs blog on github pages i updated favicon in a commit but the favicon didnt updated in the prod site
Answered by B33fb0n3
Seems like it was a caching issue ^^
https://nextjs-forum.com/post/1277941566497099858#message-1277980146179244143
After deleting the cache and redeploying the project, the correct favicon showed up.
https://nextjs-forum.com/post/1277941566497099858#message-1277980146179244143
After deleting the cache and redeploying the project, the correct favicon showed up.
47 Replies
Original message was deleted
one sec
here is the repository link https://github.com/oyepriyansh/blog
@! priyansh ★ here is the repository link https://github.com/oyepriyansh/blog
It looks like a local caching issue. I created a reproduction of it. Thanks for sharing your project.
https://codesandbox.io/p/github/oyepriyansh/blog/main
As you can see, there is a favicon, so your code is 100% correct. However, there might be some issue locally. To clear the cache, open the dev tools, go to "Network" and checkmark "Disable cache". Now keep the dev tool open and reload your page. The favicon is now visible. If not, check inside the network tab, from where the favion was loaded and maybe even preview it there, to see if it's the correct one
https://codesandbox.io/p/github/oyepriyansh/blog/main
As you can see, there is a favicon, so your code is 100% correct. However, there might be some issue locally. To clear the cache, open the dev tools, go to "Network" and checkmark "Disable cache". Now keep the dev tool open and reload your page. The favicon is now visible. If not, check inside the network tab, from where the favion was loaded and maybe even preview it there, to see if it's the correct one
@B33fb0n3 It looks like a local caching issue. I created a reproduction of it. Thanks for sharing your project.
https://codesandbox.io/p/github/oyepriyansh/blog/main
As you can see, there is a favicon, so your code is 100% correct. However, there might be some issue locally. To clear the cache, open the dev tools, go to "Network" and checkmark "Disable cache". Now **keep the dev tool open** and reload your page. The favicon is now visible. If not, check inside the network tab, from where the favion was loaded and maybe even preview it there, to see if it's the correct one
in the production site oyepriyansh.github.io/blog it is showing the old favicon, i tried on multiple device after latest commit
@! priyansh ★ in the production site oyepriyansh.github.io/blog it is showing the old favicon, i tried on multiple device after latest commit
have you tried it like I mentioned [here](https://nextjs-forum.com/post/1277941566497099858#message-1277944394288337010)?
What was the result?
What was the result?
@! priyansh ★ i tried
can you redeploy your project once and check the same again
@B33fb0n3 can you redeploy your project once and check the same again
alr, should I delete repo or just delete and rewrite the yml file?
@! priyansh ★ alr, should I delete repo or just delete and rewrite the yml file?
nothing from that. Just a redeploy
now I opened the site in my new device for the first time and still the old icon appears
now I get this favicon as well. And that's also the icon, that is in [your file dir.](https://github.com/oyepriyansh/blog/blob/main/app/icon.ico) So everything is fine now, right?
@B33fb0n3 now I get this favicon as well. And that's also the icon, that is in [your file dir.](https://github.com/oyepriyansh/blog/blob/main/app/icon.ico) So everything is fine now, right?
the icon in my file dirr is my pfp not this showing in the site
the icon currently showing is from old commit
@B33fb0n3 I might be wrong, but is it cached by your server?
you are correct maybe
i dont have much idea
perhaps because favicon is aggressively cached, it gets cached by github (appears like you're using github pages) and it might take a while (or even never) for it to be revalidated
ig try appending
?v=1 after favicon.ico and see if that revalidated the cache?https://stackoverflow.com/questions/2208933/how-do-i-force-a-favicon-refresh yeah here's an SO question
@iyxan23 ig try appending `?v=1` after `favicon.ico` and see if that revalidated the cache?
There is no favicon.ico request that me actively create. It's handled by nextjs. And yes, the max-age is 31556952. So... it will either take some time or he can revalidate it himself. I thought the redeploy would invalidate the server cache... but looks like it does not.
@! priyansh ★ invalidate your server cache
@! priyansh ★ invalidate your server cache
i dont think its possible to invalidate github pages' cache tho
its automatically handled by github
got it
@! priyansh ★ Click to see attachment
delete it 😈
@! priyansh ★ deleted
redeploy it
@B33fb0n3 redeploy it
it will be queued
until precious dont succed
and i tried canceling previous one but it says requested
how long does it take?
i am cooked
oho 💀
ok it is resolved now, I just deleted the repo and pushed the code into a new repo
my bad I thought it's nextjs issue
@! priyansh ★ my bad I thought it's nextjs issue
Seems like it was a caching issue ^^
https://nextjs-forum.com/post/1277941566497099858#message-1277980146179244143
After deleting the cache and redeploying the project, the correct favicon showed up.
https://nextjs-forum.com/post/1277941566497099858#message-1277980146179244143
After deleting the cache and redeploying the project, the correct favicon showed up.
Answer
West African Lion
I'm not sure if this is still relevant, but I was running into a similar issue. When making a new NextJS project, it puts the
Only when I moved the favicon to a public folder, did it update as expected? Why does it have the favicon in the app folder by default if you can't leave it there?
favicon.ico in the app folder. I tried changing the icon, but the best I got was an image with a white background (instead of transparent).Only when I moved the favicon to a public folder, did it update as expected? Why does it have the favicon in the app folder by default if you can't leave it there?
@West African Lion I'm not sure if this is still relevant, but I was running into a similar issue. When making a new NextJS project, it puts the `favicon.ico` in the `app` folder. I tried changing the icon, but the best I got was an image with a white background (instead of transparent).
Only when I moved the favicon to a public folder, did it update as expected? Why does it have the favicon in the app folder by default if you can't leave it there?
it works when u name the icon as
favicon.ico or icon.ico in the app folder