App Router (the app/ folder)
Delete the default app/favicon.ico that create-next-app added, then put your own files in the root of app/ with these exact names:
app/
├── favicon.ico ← multi-size ICO (16, 32, 48)
├── icon.svg ← sharp vector icon for modern browsers
├── apple-icon.png ← 180×180, solid background
├── layout.tsx
└── page.tsxNext.js generates the <link rel="icon"> and <link rel="apple-touch-icon"> tags for you, including the correct type and sizes. Don't also add them by hand.
Note the names: it's icon.svg (not favicon.svg) and apple-icon.png (not apple-touch-icon.png). FavMint's package uses the standard web names, so rename those two when you copy them in.
Android icons and the manifest
Put android-chrome-192x192.png and android-chrome-512x512.png in public/, then add app/manifest.ts:
import type { MetadataRoute } from 'next';
export default function manifest(): MetadataRoute.Manifest {
return {
name: 'My App',
short_name: 'My App',
icons: [
{ src: '/android-chrome-192x192.png', sizes: '192x192', type: 'image/png' },
{ src: '/android-chrome-512x512.png', sizes: '512x512', type: 'image/png' },
],
theme_color: '#ffffff',
background_color: '#ffffff',
display: 'standalone',
};
}Or keep FavMint's site.webmanifest in public/ and point to it with export const metadata = { manifest: '/site.webmanifest' } in app/layout.tsx.
Using the metadata object instead
If you'd rather keep all icons in public/, declare them in your root layout:
// app/layout.tsx
import type { Metadata } from 'next';
export const metadata: Metadata = {
icons: {
icon: [
{ url: '/favicon.ico', sizes: '32x32' },
{ url: '/favicon.svg', type: 'image/svg+xml' },
],
apple: '/apple-touch-icon.png',
},
manifest: '/site.webmanifest',
};Pick one approach. If app/favicon.ico still exists, it will be used alongside the metadata icons, so remove it.
Pages Router (the pages/ folder)
Copy all the files into public/, then add the tags to pages/_document.tsx so they're on every page:
// pages/_document.tsx
import { Html, Head, Main, NextScript } from 'next/document';
export default function Document() {
return (
<Html lang="en">
<Head>
<link rel="icon" href="/favicon.ico" sizes="32x32" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}Still seeing the Next.js or Vercel icon?
Restart the dev server after adding or renaming icon files, then hard-reload or open a private window. In production, the old icon can stick around in browser caches for a while. More fixes in favicon not showing.