For some reason my favicon is not working.
I have the favicon saved as favicon.ico in the /public directory and am referencing it in the <Head>
of my pages (located in the /pages directory) but to no avail.
Can anyone help?
-
Here is my code for my index.js:
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
dir/pages/index.js
dir/public/favicon.ico
Put the favicons in an /image
directory inside the /public
directory and put the code below in your _app.js
<Head>
<link rel="shortcut icon" href="/images/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png"/>
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png"/>
</Head>
I was facing exactly the same issue as you did. It seems it is necessary to put the image file in /public/images/
It turns to work properly once I have done this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With