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 need to replace the current markup within our template with the following new markup:
New markup
<article{{ attributes }}> {{ content }} </article>
Make sure to save the template, clear Drupal's cache, and refresh the Blog page. At...