Working with templates
Templates help provide variables inside of HTML markup to define the rendering of content in Drupal. The following sections outline how to work with templates.
How to find and create templates
One of the first things you’ll need to do is figure out what template to use and create. You can find current templates that enable Twig Debug (which we talked about earlier) at /admin/config/development/settings
.
Doing so will tell Drupal to output HTML comments in the markup that indicate what templates are in use, and what templates are available. Note that your theme’s templates (except Single Directory Components) will reside in the theme’s /
templates
directory.
Figure 19.4 – Template suggestions in rendered HTML comments
In the preceding example, you can see under FILE NAME SUGGESTIONS:
that six items are listed, with X
next to the last (node.html.twig
). This means that node.html.twig
is in use, and...