We have created views and URL patterns for our application. Now it's time to add templates to display posts in a user-friendly way.
Create the following directories and files inside your
blog application directory:
templates/ blog/ base.html post/ list.html detail.html
This will be the file structure for our templates. The
base.html file will include the main HTML structure of the website and divide the content into a main content area and a sidebar. The
detail.html files will inherit from the
base.html file to render the blog post list and detail views respectively.
Django has a powerful template language that allows you to specify how data is displayed. It is based on template tags, which look like ...