Sidebar layout

The other kind of sidebar, and the one it is easy to confuse with the first: not a region of the page, but a region of the layout the content is laid out with, inside the content region and inside the same block as the body it sits beside. It is what an entity displayed through a sidebar layout renders as, so it holds what the thing is -- its state, what it belongs to, when it last changed -- rather than the navigation of the site. The layout is a real layout plugin, asked of the layout plugin manager and handed the regions it declares, so a theme that ships its own sidebar layout is the one being checked here; the core two column layouts stand in for a theme that ships none. Its regions hold field blocks, the wrapper layout builder puts around a field, because the space between two of them in a meta column is set on the block rather than on the field. The page fills no sidebar region, so the layout has the full width of the content region to work in.

This is the second shape a sidebar comes in, and the one that is easy to confuse with the first. The column on the side of this text is not a region of the page: it is a region of the layout the content is laid out with, and it lives inside the content region, in the same block as the body it sits beside.

The difference matters as soon as a page has both. A page sidebar belongs to the site and holds the same navigation on every page of a section. A layout sidebar belongs to the thing being displayed and holds what that thing is: its state, who it belongs to, when it last changed. One is chrome, the other is content, and a theme that styles them the same way is telling a visitor they are the same kind of thing.

It also matters for the width the layout has to work in. A page sidebar measures itself against the window; a layout sidebar measures itself against whatever the content region turned out to be, which is narrower on a page that already has a page sidebar. That is the case a layout with a container query gets right and a layout with a media query does not, and it is what the combined example is for. Here the content region is the full width, so the layout is being seen at its widest and on its own.

Each field beside this one is wrapped in a field block, the block layout builder puts around a field when it places it in a layout region. A theme sets the space between two of them on the block rather than on the field, so the wrapper is worth keeping in an example even where nothing is being built by layout builder.

The strip below the column is the third region of the layout. It is the one that is usually empty, which is exactly why it is filled here: a region a theme has never seen filled is a region whose spacing has never been checked.

Status
Open
Section
Updated