In website development, you will quickly notice that you create same links multiple times or repeatedly on different pages.
For example, if you have home.html, list_items.html, add_items.html.
If you create a link on one page, you will need to make sure you have the same link on all other pages. Therefore, on a traditional website (just HTML and CSS), you will duplicate the links on other pages.
This makes it tedious to update and maintain the website. Since you change a link name or address on one page, you will need to do it on the other pages as well.
Django has a simple solution for this by utilizing include keywords. This is what i will be showing you on this section this blog.
- Create a navbar.html page and add all the links (URL) to all pages of your application.
<nav>
<li><a href="/">Home</a></li>
<li><a href="/list_invoice">List Invoices</a></li>
<li><a href="/add_invoice">Add Invoices</a></li>
</nav>
3. Now on every html page (template) e.g. home.html, list_items.html, add_items.html
, Above the body page, add the following code to include the navbar.
{% include 'navbar.html' %}
At the end of these tutorial make us the last epsode to be deployment on heroku or Git
Sure I will host it online inshaAllah