Don't Fear Templates: Using Twig Templates with Pages, Nodes, Views, and more!

jmickela
megclaypool

Even today, with Twig templates in Drupal 8, it's common to see sites being made with hacks to avoid writing templates (I'm looking at you hidden Views fields being used in a psudotemplate) and people using a wide range of modules that often do nothing but add a small amount of static HTML to node output (social sharing, social commenting, third party integrations in general), or layout tools that essentially just shift the hassle of writing templates to the hassle of themeing extremely generic output.

While the array of layout tools at our disposal today have their place, they don't replace the need for simple templates. I'll go over some common use cases where Twig templates are an easy and efficient solution including: site hero/banner images, social sharing, Views output, and nested Paragraphs to create a simple slideshow. How to create and add new template files.

To get the most out  of this session you should be comforable with building Views, setting up Content Types, and setting up a theme. 

Program tags

back end development, front end development, site building

Experience Level

Intermediate

Drupal Version