0

I have navbar html template nav.html I want to use it on other html files. I am creating a web application on pyhton flask.

enter image description here I dont to write the same code on every page. I want to create once and user any where.

  • 2
    You can use the [include tag](https://jinja.palletsprojects.com/en/3.1.x/templates/#include) to render a template in another template. However if your navigation is reused in all the templates, why not make a base template that they [extend](https://jinja.palletsprojects.com/en/3.1.x/templates/#extends)? – Oluwafemi Sule Dec 31 '22 at 07:46
  • That works, Great!! Why google not gave me that simple answer before – Amir Hassan Dec 31 '22 at 08:03
  • Does this answer your question? [How to extend a base Flask Jinja template from a Blueprint template?](https://stackoverflow.com/questions/11233959/how-to-extend-a-base-flask-jinja-template-from-a-blueprint-template) – Patrick Yoder Dec 31 '22 at 11:24

0 Answers0