![]() |
VOOZH | about |
Template inheritance allows multiple HTML pages to share a common layout using Jinja templates. A base template contains common sections such as headers, footers and navigation bars, while other templates inherit and customize specific parts of that layout.
First, create a basic Flask application with multiple routes.
Explanation:
Create a file named base.html inside the templates folder. This file contains the common layout shared by all pages.
base.html
Explanation:
Create a file named home.html inside the templates folder.
home.html
Explanation:
Create a file named about.html inside the templates folder.
about.html
Explanation:
The home route displays the Home Page template:
The /about route displays the About Us page using the same base layout.
Explanation: