Search⌘ K
AI Features

Homepage with Navbar

Explore how to create a reusable navbar in Django by setting up a base template with common navigation links and extending it in child templates. Understand the use of block and extends tags to maintain consistent page layouts and improve user navigation across the website.

In this chapter, we will focus on adding a navbar with links to the other pages. This means we’ll no longer have to keep typing out the URL for the pages.

The first step in adding a navbar is to create a file called base.html in the templates folder which will serve as our parent template. This means that we’ll pass this template to other pages since it has common elements for all pages such as a navbar.

When we style the website, we will include a fully functional navbar. For now, let’s ...