Locked lesson.
About this lesson
In this lesson, we'll discuss how Block Titles work and how to include them within your Django project pages.
Exercise files
Download this lesson’s related exercise files.
Block Title.docx57.3 KB Block Title - Solution.docx
57.8 KB
Quick reference
Block Title
Block Title is used to add different titles to every page of your website while still using the extends base file.
When to use
Use block titles whenever you want to add a different title than the default title that's in your base.html file.
Instructions
To use a block title, modify your base.html to look like this:
<head>
<title>{% block title %}Default Title{% endblock %}</title>
</head>
And then modify any individual webpage to look like this:
{% extends 'base.html' %}
{% block title %}Homepage Title{% endblock %}
Hints & tips
- {% block title %}Homepage Title{% endblock %}
Lesson notes are only available for subscribers.