dynamic favicon for routes
Answered
Korat posted this in #help-forum
KoratOP
hi, is it possible to make a dynamic favicon for routes? i want to use different favicons for every page. I've searched it but nothing worked
Answered by B33fb0n3
yes you can do this by creating multiple metadata objects inside your different pages. You also want it dynamic, so you can [use the generateMetadata function](https://nextjs.org/docs/app/api-reference/functions/generate-metadata). Like that you can add a icon url too and have dynamic icons the pages that you want
10 Replies
yes you can do this by creating multiple metadata objects inside your different pages. You also want it dynamic, so you can [use the generateMetadata function](https://nextjs.org/docs/app/api-reference/functions/generate-metadata). Like that you can add a icon url too and have dynamic icons the pages that you want
Answer
KoratOP
the first way that you said didn't work
how should I specify the favicon directory?
your metadata could look like this:
Now you only need to add multiple metadatas to different files and they will automatically change when you change the page/layout
{
// ...other meta tags
icons: ['https://static-00.iconduck.com/assets.00/star-icon-2048x2048-vsj84iil.png'], // the path to your file
};
Now you only need to add multiple metadatas to different files and they will automatically change when you change the page/layout
KoratOP
like that?
no, more like this: https://nextjs-forum.com/post/1299746621583785994#message-1299781751962468433
So instead of providing an object, provide it as array
don't ask me why it's an array, but it's an array
So instead of providing an object, provide it as array
don't ask me why it's an array, but it's an array
KoratOP
Ive tried using icons as png inside my project's directory but didnt work. Im using static website link instead.
It has worked with that.
Happy to help