Create a free account to get access to additional free training videos. Enjoy this free video from CraftQuest! Create a free account to get access to additional free training videos. Join the Community

Flexible Twig Templates in Craft 3

Introduction to the Course

Ryan introduces the course, covering what we need and what we'll learn.

Dur­ing this course we will build a flex­i­ble tem­plate stack — a set of Twig tem­plates that togeth­er to gen­er­ate the site pages — that can be used by every sec­tion of the site, even new sec­tions that have no tem­plates cre­at­ed specif­i­cal­ly for them. The tem­plates are includ­ed dynam­i­cal­ly based on the Sec­tion han­dle and the Entry Type handle.

The goal of the course is to learn how the tem­plate stack works and to demon­strate some more advanced usage of Craft and Twig.

We hope that this will stim­u­late ideas for how you can improve your own site imple­men­ta­tions so your tem­plates are as reusable and con­cise as possible.

Here’s what we’ll learn in this course:

  • How to cre­ate gener­ic, reusable Twig tem­plates in Craft
  • How to build a tem­plate sys­tem with a nam­ing con­ven­tion that makes it sim­ple and pre­dictable to add new con­tent sec­tion and entry types.
  • How to use Twig includes with vari­ables so we can smart­ly pass data into the includ­ed template.

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