Locked lesson.
About this lesson
There will be times when you want to include things only on one page. In this lesson, we'll discuss how Include Tags work and how to use them within your project pages.
Exercise files
Download this lesson’s related exercise files.
Include Tag.docx60.3 KB Include Tag - Solution.docx
57.6 KB
Quick reference
Include Tag
Include allows us to include other files on an individual web page.
When to use
Use it when you want to include things on a single web page, as opposed to extends; which adds things to all web pages.
Instructions
To use the include tag, create a directory in your templates directory named snippets (or name it anything you like). Place a file in the snippets directory (we'll call it footer.html). To include footer.html into a web page, use this tag:
{% include 'snippets/footer.html' %}
Hints & tips
- {% include 'snippets/footer.html' %}
Lesson notes are only available for subscribers.