In the previous chapter, you created functionality to support users logging in and out of the MyBlog application. Logging in and out is essential functionality we need to make easily accessible to users. Therefore, you’ll add this navigation functionality to the parent base.html template so that it’s available everywhere on the MyBlog application.
You’ve created a working authentication system, but, currently, it’s accessible primarily by entering the URL into the browser navigation bar. Let’s add the login/logout URL routes to the Bootstrap navigation system.
The authentication system has two mutually exclusive states as a user; you can only be logged in or logged out. Because of this, the authentication system is represented in the navigation menu as a single item that toggles between states depending on the user’s current authentication status. Keeping with the idea of single responsibility and not overcomplicating the base.html template, the login/logout menu functionality will exist as a Jinja macro in the examples/CH_09/examples/01/app/templates/macros.jinja file: