0

Block region Demonstration of Drupal 8 W3CSS Theme

The picture shows the block region demonstration of a Drupal theme that I am using.

I am new to Drupal.

As the structure is given, I want to use different structure in different pages of my site. Say, at home page I want to use all the block regions Left Sidebar, Content and Right Sidebar. But for another page (one of the main navigation) I only want to use one of the sidebars with content and leave other sidebar. Also I want to add custom blocks at various regions on different pages.

Is this possible? If yes, how should I do it?

0

Theme block regions are just empty placeholders that mark up certain points within your HTML. Regions don't affect your site on their own, it is only when you put Blocks inside them that they show up.

Most (if not all) themes first check that a region isn't empty before printing the region container into the HTML. So regions don't appear in your HTML if there are no Blocks inside them.

What you should be focused on instead is Block Visibility, not regions. It makes more sense to control where each piece of content should appear, instead of controlling the containers/regions.

And you can control for each Block on which pages it should appear, so that is how you achieve the different structure of the pages. Some Blocks you set to display for example in sidebars regions but only on the front page. Some Blocks you put in the sidebar but only on node pages.

If there is a page that doesn't have any blocks set to appear in sidebars, then this page will not show any "sidebar area". It will be up to your theme CSS to style what the page without sidebars looks like. Most likely it will just be a simple one column area for your content.

There are modules that allow you for more control over the Blocks placement (Context for example), that do something that could be described as turning regions on or off, but that is a slightly different approach and I think you should play with the original Blocks arrangement first if you're new to Drupal. It is much easier to understand and setup Blocks to be visible on only sections of your website.

In Drupal 8 you can place the same Block more than once, in another region, or even the same region. You can then adjust the Visibility to different conditions, so for example you can have your Main navigation displayed in Header region on the front page, but displayed in the sidebar on all other pages.

BTW the above example isn't the best one, navigation should be always in the same place for accessibility and other reasons. But I hope you understand the concept of placing Blocks in regions, but then using Visibility to make them appear on only certain pages, and not others.

  • Thanks a lot for your help, it really made it clear for me. And you misunderstood me, I don't wan to chance the appearance of navigation, I was just saying that the other page I want to configure is one of the main pages which is linked in navigation(Like Home, Contact Us and Help are one of the main pages given navigation). But I made that page with help of "Views", is it okay that way or should I follow another approach? And how do I edit the appearance of that page which I made as "Views" page? – Samarpit Shrivastava Nov 17 '18 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.