How to Add favicon.ico on Next.js 13 & Next.js 14 #50704
-
SummaryI wanted to Add favicon.ico on my website how can i do that Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments 53 replies
-
EditEveryone is getting confused, let me make this simple. ConventionPlace
ElsePlace the favicon file(s) on the public, then use export const metadata = {
icons: {
icon: '/icon.png', // /public path
},
} You can also change favicon by color scheme: icons: {
icon: [
{
url: '/light-icon.png',
media: '(prefers-color-scheme: light)',
},
{
url: '/dark-icon.png',
media: '(prefers-color-scheme: dark)',
},
],
}, Reference |
Beta Was this translation helpful? Give feedback.
-
Yup Just Put thanks @devjiwonchoi |
Beta Was this translation helpful? Give feedback.
-
I want to put my |
Beta Was this translation helpful? Give feedback.
-
Hi. The successful code is something like below. import Favicon from '/public/images/Metadata/favicon.ico';
export const metadata: Metadata = {
title: 'Next.js',
description: 'Generated by create next app',
icons: [{ rel: 'icon', url: Favicon.src }],
}; Hope it helps. |
Beta Was this translation helpful? Give feedback.
-
Sometimes after putting the favicon.ico into /app or /public + "link" element you still need to reset the browser cache for the icon to be displayed. Try reset brower with cmd+q on at least, dont know how it works on Windows. Thats what helped me. |
Beta Was this translation helpful? Give feedback.
-
I just added an /app directory in my project root that contains a favicon.ico file. It just worked out of the box. I didn't need to import or set up any additional components. |
Beta Was this translation helpful? Give feedback.
-
In Next 14, just rename the favicon to icon and put it in the app folder. Everything will automatically work the way it should! You don't need to look for other solutions anymore) |
Beta Was this translation helpful? Give feedback.
-
I was struggling with this problem on MacOs and this help me https://stackoverflow.com/a/76301605 |
Beta Was this translation helpful? Give feedback.
-
With me the file don't working more with favicon in Vercel. I using now Reference: This Links Using I'm Brazilian! |
Beta Was this translation helpful? Give feedback.
-
If your favicon is not in |
Beta Was this translation helpful? Give feedback.
-
Fixes which worked for me
|
Beta Was this translation helpful? Give feedback.
-
You can even use an svg icon by specifying it in the main layout in this way: "next": "14.2.7", And everything works fine. |
Beta Was this translation helpful? Give feedback.
-
Guys, how can I add an svg icon as a favicon? As per doc, I tried moving it into /app and /public directory with icon name of the file but it doesnt work. In network browser tab i have a 404 error for favicon.ico in _document.tsx i have this:
|
Beta Was this translation helpful? Give feedback.
-
Just delete the favicon.ico and paste your favicon in the |
Beta Was this translation helpful? Give feedback.
-
This was really helpful. Thank you❤️ |
Beta Was this translation helpful? Give feedback.
Edit
Everyone is getting confused, let me make this simple.
Convention
Place
favicon.ico
inside theapp/
orpublic/
folder, which Next.js will auto-generate the necessary metadata.Else
Place the favicon file(s) on the public, then use
Metadata
orgenerateMedatada
.You can also change favicon by color scheme:
Reference