A base template is the parent page for a site. It holds shared HTML—such as the document structure, navigation, footer, and styling hooks—while named blocks mark the parts child templates can replace. In Django, a child template uses {% extends "base.html" %} and overrides matching {% block %} regions. section 3.8 section 3.8.1
A practical inheritance arrangement works like this:
- Create base.html with common HTML and blocks such as title and content. section 3.8.1
- Extend the base from a page such as news2.html, then define only the blocks that need different content. section 3.8.1
- Use {{ block.super }} when a child should add to the parent block instead of replacing it. section 3.8.1
- Point the view at the new child template, run the development server, and revisit the URL to verify the result. section 3.8.1
RiffMates page inheritance
base.html defines a title block defaulting to “RiffMates” and an empty content block. news2.html extends it, changes the title to “RiffMates: News” with {{ block.super }}, and supplies an h1 plus a news list. Shared styling added to base.html then applies to every inheriting page. section 3.8.1
Figure 3.4 Page inheritance for component reuse
A hierarchy can layer variations: a main page, a navigation-enabled parent, and concrete site pages. section 3.8

