Title and Logo in Navbar
Using Navbars
Adding title and logo
To change the value of the title
and logo
in the navbar function, we need to edit the themeConfig
object in the docusaurus.config.js
file of our project.
Here's a step-by-step guide on how we made those changes:
Opening the
docusaurus.config.js
file in our project's root directory.Locating the
themeConfig
object within the file. It should be defined as follows:docusaurus.config.jsthemeConfig: {
// Your theme configuration goes here
},To change the title of the navbar, we located the
title
property within thenavbar
object, and updated its value to the desired title:docusaurus.config.jsnavbar: {
// Other navbar properties go here
title: 'TCET Open Source',
// Other navbar properties go here
},To change the logo of the navbar, we located the
logo
object within thenavbar
object, and updated itssrc
andalt
properties to the desired logo image and alt text:docusaurus.config.jsnavbar: {
// Other navbar properties go here
logo: {
alt: 'TCET Open Source Logo',
src: 'img/logo.png',
},
// Other navbar properties go here
},infoIn our case we had the logo of our website at
/img/logo.png
Save the
docusaurus.config.js
file.Run
yarn start
ornpm start
to see the changes reflected in your local development environment.
With the title and logo completed, it's time we move onto adding items to our navbar.