Home > Net >  Django, how to display separate html blocks, which can then be edited in one place
Django, how to display separate html blocks, which can then be edited in one place

Time:11-27

I need to display the navbar, footer, main, base, title - in separate blocks, which can then be edited in one place, and the changes will occur everywhere

Сan you give me an idea how to do it, I have no idea just

I thought to do it with this function

{% extends "..{directory}/{the name of html page}.html" %}

But I think this won't work

CodePudding user response:

Django supports reusable HTML files out-of-the-box

Create your navbar, footer, and other additional files(if any) separately (most often this type of files stored in includes directory), and then you can use them to any files you want by doing so...

{% include 'path/to/template.html' %}

For further reading check the documentation

  • Related