amannn / next-intl

🌐 Internationalization (i18n) for Next.js
https://next-intl-docs.vercel.app
MIT License
2.58k stars 236 forks source link

Favicons with MetaData API files system not working #1513

Closed da-kicks-87 closed 1 week ago

da-kicks-87 commented 1 week ago

Description

This is for Next.js 14.2.16. - App Router

Hello after installing next-intel the favicon no longer load from the file-based metadata system. I had tried to have the favion.ico in /src/app/[locale] and /src/app. (https://nextjs.org/docs/app/api-reference/file-conventions/metadata/app-icons)

I got the favicons to work by doing the alternative by using Next.js metadata export object and putting the favicons in the /public/favicons

Eg from layout.js:

export const metadata = {  icons: {
    icon: [
      { url: '/favicons/favicon-96x96.png', type:'image/png', sizes: '96x96' },
      { url: '/favicons/favicon.svg', type:'image/svg+xml',},
      { url: '/favicons/favicon.ico' },
    ],
    shortcut: '/favicons/favicon.ico',
    apple: { url: '/favicons/apple-touch-icon.png', sizes: '180x180' },
    other: {
      rel: 'manifest',
      url: '/favicons/site.webmanifest'
    }
  }, }

However the Next.js guide mention i should be using the special metadata files inside the app folder for favicons. What should I do?

Verifications

Mandatory reproduction URL

/sorry-offline

Reproduction description

See above description

Expected behaviour

See above description

amannn commented 1 week ago

The next-intl examples currently simply put a favicon.ico in public—that seems to work for me. I'm not aware of if there are implications for other patterns. There might be details relevant to your app, like a potential matcher you're using the middleware config.

I'll move this to a discussion since it's a Next.js usage question and not a bug report about next-intl.