Next.js Discord

Discord Forum

favicon not updating

Answered
! priyansh ★ posted this in #help-forum
Open in Discord
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.
View full answer

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
@! 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?
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?
the icon currently showing is from old commit
I might be wrong, but is it cached by your server?
i dont have much idea
this thread reminded me of realfavicongenerator.com where they had this option at the bottom
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?
@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
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 😈
@B33fb0n3 delete it 😈
deleted
bruh
now the workflow run is queued
wtf
@! 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.
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 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?