Flexible Twig Templates in Craft

In this course Ryan teaches the Flexible Template Stack, an approach put together by developer Anthony Colangelo. The Flexible Template Stack in Twig and Craft allows you to have reusable templates that can render content from any section of the site. This is a setup you can use over and over again on your Craft-powered projects.

Flexible Twig Templates in Craft is made up of the following videos:

1 Introduction Let's set the stage for the course, covering what we need and what we'll learn. 03:34
2 What We're Building We review the sample site we'll build in this course. 06:06
3 Reviewing the Template Stack We use a stack of paper to talk through how the Twig template stack will work. 05:09
4 Walking Through Template Stack Code Let's jump into the code now and step through how the template stack works. 05:06
5 Introducing Handler Templates Handler templates are the first layer of templates that handler all layouts on the site. Let's review how they work. 02:50
6 Entry Handler Template The Entry handler template is used for every single entry view, no matter the section or content. 06:00
7 Item Handler Template The Item handler template is used to render the content on listing pages. 04:46
8 Matrix Handler Template The Matrix handler template renders all Matrix fields site-wide. 03:29
9 Preparing to Code the Template Stack We need to make sure we have everything in place before we start coding our template stack. 01:20
10 Reviewing the Supporting Templates Handler templates don't work alone. They need help from supporting templates. 03:08
11 Creating the Homepage Listing Template Let's build our template stack by starting with the homepage. This is a listing template so we'll need to build out our Item handler template. 10:58
12 Creating the Included Templates The Included templates do the heavy lifting of rendering the content in the appropriate layouts. 06:55
13 Finishing the Homepage Listing Template We wrap up our implementation of the homepage. 09:11
14 Completing the Matrix Handler Template Earlier we had to create a Matrix handler template stub to get around an error. Let's go back and code that template now. 10:32
15 Creating the Entry Handler Template It's time to implement the Entry handler template so we can click through from the homepage and display the single entry views. 12:10
16 Testing the Template Stack With our template stack complete let's test it by creating a new content Section and see how it works! 06:11
17 Closing A few words of encouragement and congratulations for completing the course. Confetti not included! 01:03