How to change the favicon in Gatsby
In this tutorial, we are going to learn about how to change the default favicon in gatsby project which is set by the gatsby-cli
.
Changing the favicon
-
Open the gatsby project in your favorite code editor.
-
Download the favicon and place it inside the
src/images
folder. -
Install the
gatsby-plugin-manifest
by using the following command.
npm i gatsby-plugin-manifest
- Navigate to the
gatsby-config.js
file and add the following configuration inside theplugins
array by replacing it with your icon path.
gatsby-config.js
module.exports = {
/* Your site config here */
plugins: [
{
resolve: `gatsby-plugin-manifest`,
options: {
name: 'React go',
short_name: 'Reactgo',
start_url: '/',
background_color: '#f7f0eb',
theme_color: '#a2466c',
display: 'standalone',
icon: 'src/images/pro-icon.png', },
}
// other plugins goes here
],
}
- Restart the development server by running the
gatsby develop
command and reload your gatsby app to see a new favicon.