07/26/2019, by Mikhail Ismajlov

In Drupal 8, as in previous versions, you can add additional blocks in the regions.Usually in the Drupal themes there are regions: Header, first and second sidebar, content and footer of the site. Let's go to the Menu - Structure — Block Lyout. In the Bartik theme we have the following regions:

Primary menu
Secondary menu
Featured top
Sidebar first
Sidebar second
Featured bottom first
Featured bottom second
Featured bottom third
Footer first
Footer second
Footer third
Footer fourth
Footer fifth

You can output blocks in any of these regions, for example, you can output a block Search in sidebar second:

Search block

Thus we will have three columns:

block editing

We can make a two-column layout with the right sidebar (possibly for SEO purposes), for this you just need to transfer all the blocks from the first sidebar to the second:

two column layout

Then it will look like this:

second sidebar

I think with blocks and regions, everything is quite clear, let's look at the parameters of the visibility of the block, each block has it. Sometimes it is necessary that the block is shown only to the administrator, for example, the block for adding content, then we go to the roles tab and select which roles to display the block:


visibility options

We can also display blocks on separately selected pages of content types. Let's configure the Search block.

content block

We add output only on the pages of articles, so the search block will not be displayed either on the home page or on the pages of other types of materials, only on the pages of articles.

drupal block settings

If we need to display a block on all pages except the main one, then we need to use the Pages tab. Let's display the Powered by Drupal block on all pages except the ho one:

block on the home

We use to display the block on all pages except the home one, and if, on the contrary, you only need to display the block on the home page, then just tick the Show for the listed pages. We can also use the * sign to display on all pages where you can substitute something for an asterisk, for example node / * are pages of nodes, taxonomy / term / * are taxonomy terms pages, user / * are user pages. If you need to write several conditions, then we write the condition on the next line:

visibility conditions

You can also combine conditions from the Page, Roles and Content Types, for example, you can only display a block on article pages and only administrators.

With the blocks finished, we will continue to create blocks using the Views module, but for now you can proceed to the next lesson.

Did this help?

Why wasn't this information helpful

Limit to 250 characters.