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.jsfile in our project's root directory.Locating the
themeConfigobject 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
titleproperty within thenavbarobject, 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
logoobject within thenavbarobject, and updated itssrcandaltproperties 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.pngSave the
docusaurus.config.jsfile.Run
yarn startornpm startto 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.