Is aside suitable for sidebars in Drupal? No, I don't think so, here's why...

This is bound to stir up some debate because in fact you can use aside to markup sidebars, it could be a good fit, but in Drupal core, or in a generic theme (as in one not built specifically for your site) then using aside is wrong and I am going to argue as to why this is so.

A little bit about aside element. Early on the aside element was pretty much deemed inappropriate for use outside the article element, in other works tangential content outside the main article was not considered aside content. That changed and suddenly it became possible that sidebars could in fact be aside content. Cool, no issues there.

In Drupal sidebars are just regions that happened to be named sidebar this, sidebar that, and happen to be presented as columns, normally adjacent to the main content. So sidebars in Drupal are merely presentational. Keep this in mind.

Normally we can place any block in any region, and place any region anywhere on the page. So theoretically I can place these sidebar regions anywhere in the source order, and anywhere on the screen. I can use media queries and build responsive designs that move the sidebar regions depending on the screen resolution, I can even unset the sidebars completely and not use them at all.

The points I am making is that we can never assume or know where a sidebar region might be displayed, or what the content of any region might be.

So we can't make assumptions about regions, but we can make very strong assumptions about the content of a block. We can even know exactly what the block will contain because we created it with Block module or Views or some other module. Lets say we create a block with Views that contains a list of related content - we can create a block template that marks this up as aside content and put it anywhere in the page, in any region and its specific semantics are aside content. This is far more granular than simply marking up the sidebars as aside, which as we know may not actually contain any aside content at all, and in fact they may not even exist.

For me I don't need to go any further in this explanation - its as simple as that - semantics should be at the block level, not at the region level, unless you are custom building the theme and now exactly what the content of the region will be.

My overall point being that if we are going to focus on delivering enriched semantics in Drupal 8 we better be thinking blocks, not regions. Blocks allow us to have granular control over the outline and the specific semantics we want to apply, or are demanded by the content on the block. Marking up entire regions in semantic HTML5 elements makes way too many assumptions about the content of the region, which IMO should always be div's and kept purely in the presentational layer.

Last updated 13th August, 2011 - 3:12am

Authored by Jeff Burnz on