favico error
Answered
Николя posted this in #help-forum
НиколяOP
Hello everyone, I have favicon icons, they install fine for me, I install them in metadata in loyaut in root dir, but when I go to some page with dynamic rendering, they disappear and an error is written in the console that it cannot get them, please tell me how to fix this?
Like this
Like this
Answered by joulev
it should be
not sure what the
you should be using metadata files instead: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/app-icons
/favicon.ico not /public/favicon.ico.not sure what the
?v=4 part is for.you should be using metadata files instead: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/app-icons
13 Replies
НиколяOP
Example how i use
export const metadata = {
metadataBase: new URL('https://demon-cave.club'),
icons: {
icon: [
'/public/favicon.ico?v=4'
],
apple: [
'/public/apple-touch-icon.png?v=4'
],
shortcut: [
'/public/apple-touch-icon.png'
]
},
manifest: '/public/site.webmanifest',
};/layout.js
@Николя Example how i use
export const metadata = {
metadataBase: new URL('https://demon-cave.club'),
icons: {
icon: [
'/public/favicon.ico?v=4'
],
apple: [
'/public/apple-touch-icon.png?v=4'
],
shortcut: [
'/public/apple-touch-icon.png'
]
},
manifest: '/public/site.webmanifest',
};
it should be
not sure what the
you should be using metadata files instead: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/app-icons
/favicon.ico not /public/favicon.ico.not sure what the
?v=4 part is for.you should be using metadata files instead: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/app-icons
Answer
@joulev it should be `/favicon.ico` not `/public/favicon.ico`.
not sure what the `?v=4` part is for.
you should be using metadata files instead: <https://nextjs.org/docs/app/api-reference/file-conventions/metadata/app-icons>
not sure what the ?v=4 part is for.its probably to force browsers to not use prev cached version
and in the thread you made before, I said most of those files can be brought to app dir to mean you dont need to specify them also
App router metadata files automatically have the hash query
@riský for some reason not favicon.ico 😦
to be fair to them, favicon.ico is known to be very aggressively cached
yeah
by browsers, crawlers and whatnot
it took like 2 months for google to like my new one
this is definitely intentional innit