Next.js Discord

Discord Forum

favico error

Answered
Николя posted this in #help-forum
Open in Discord
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
Answered by 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
View full answer

13 Replies

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
Answer
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
@joulev App router metadata files automatically have the hash query
for some reason not favicon.ico 😦
@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
@joulev to be fair to them, favicon.ico is known to be very aggressively cached
the funny part is dev mode does hash it
this is definitely intentional innit