Implementing our Node template
Creating a node template is not foreign to us; our process begins the same way we would create any Twig template. We begin by inspecting the markup of our page to identify which template is currently being used and the various file name suggestions available to us. Since our Post Listing block is referencing the listing view mode of our post content type, we can create a new Twig template called node--post--listing.html.twig
.
Begin by grabbing a copy of the node.html.twig
template from core/modules/node/templates
and placing it into our themes/octo/templates
folder. We will then rename the file to node--post--listing.html.twig
so that we only affect the markup for this particular content types display. Next, we will ...
Get Drupal 8: Enterprise Web Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.