We have a content type (Page) and a vocabulary (Sections). The content type has a reference field to the vocabulary, and the vocabulary has a reference to a menu. Also, we are interested in being able to build node layouts, based roughly on the following one.


The issue with the above structure is that the header is node-specific, and the actual content (green) is node-specific, but they are disconnected.

The menu is not node-specific, it's just node-dependent, but actually it's the section's menu, and should be displayed automatically if the node belongs to the section that have assigned menu.

This disconnection of the content creates an issue when it comes to the Layout Builder module. Why? Because, through the content is being constructed from sections, namely their layouts, the sections act like a multi-value field and they are rendered linearly to create the final result.

They cannot be grouped or nested, which could potentially solve an issue because, if we could nest sections, we could just create a section with header, a section with menu and content, and in content nested multiple sections with multiple layouts. We we have to do this linearly, though, and here we have an issue, because we can create section for header, section for menu and content, but then we cannot create multiple layouts for content, because that require nesting.

There are few solutions of this problem that come to my mind right now.

  1. Render the header and menu outside of the layout builder, so to just put it in the page.html.twig or node.html.twig, which would assume extracting data required for header and rendering it properly outside of the layout builder. It doesn't feel right, as the best would be to manage all content of node in the layout builder, without doing such exceptions. As mentioned, layout builder seems to handle only linear content, so it seems to be impossible to treat header and other content separately, as different regions, to which multiple sections could be added. Regions seem to exist only in sections, not outside of them.

  2. Use something like https://www.drupal.org/project/mini_layouts to allow for layout nesting. That introduces dependency on a module in alpha version, but seems like the best bet for now. Content that is not a header, could be then put in mini layouts.

  3. Alter rendering/editing of layouts to allow me to have effectively at least a single level of nesting. The best would be if every section would have a "region" it belongs to - which could be maybe possible if I would be able to create an "overlayout", which would be a layout of layouts effectively.

As you can see, I'm aware of multiple hackish ways of solving this, but I'm looking for something that would be the least hackish of all. Maybe there is a popular third-party module that I'm missing, which could help in a more elegant way than other ideas.

Could I achieve effectively an additional level of nesting by creatively using section's configuration? Could I make section so configurable to the point of defining its "sub-layouts"? That actually seems like a very clean way of achieving what I need to achieve, without adding any dependencies. Is there anything better?

  • Guys, before you will close this question I might have an actual answer, that will be very useful for anyone who struggles with similar use case, I'm just still playing with it, I think that's a very common problem that require a canonical answer. Commented Aug 18, 2019 at 13:36
  • I edited the question to be less broad, and it's answerable, and now I believe the answer is not "you cannot", as the core issue queue would suggest. Stay tuned guys :) . Commented Aug 18, 2019 at 13:39
  • Having an answer doesn't make the question not too broad. There are four questions being asked. Each question should have a single question, not two or more.
    – apaderno
    Commented Aug 19, 2019 at 6:17
  • I think this is proposed but has no solution in core yet
    – Kevin
    Commented Aug 23, 2019 at 21:46


Browse other questions tagged or ask your own question.