After all the complex Views, Blocks, and Twig templates, adding the About Us block to our sidebar will seem quite simple. The last block to complete our Blog Listing page already exists, so adding it will just be an exercise in managing custom block layouts.
Begin by navigating to /admin/structure/block
and follow these steps:
/blog
into the Page text field./blog/*
.With our About Us block assigned to the Sidebar second region, we will want to make sure it is third in the block order. Reorder the blocks if necessary and then click on the Save blocks button. We have one final piece of theming before our About Us block is complete.
In the case of our About Us block, we need to adjust the heading to display it similar to our Categories block. This will require us to replace the current <h2>
with a <h4>
heading.
Begin by navigating to the core/modules/block/templates
folder and follow these remaining steps:
block.html.twig
and place it in our theme/octo/templates
folder.block.html.twig
to block--aboutus-2.html.twig
, based on the template suggestions.<h2>
to <h4>
:New markup
{% set classes = ['block'] %} <div{{ attributes.addClass(classes) }}> {{ title_prefix }} {% if label %} <h4{{ title_attributes }}>{{ label }}</h4> {% endif %} {{ title_suffix }} {% block content %} {{ content }} {% endblock %} </div>
Once finished, make sure to save the template, clear Drupal's cache, and then refresh the Blog listing page in the browser. Let's give ourselves a big pat on the back as our page is now complete:
18.191.93.12