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.

Submitted by Jeff Burnz on

Comments

Murray's picture

Some debate :)

Thanks for the article. It encouraged me to go off and read the spec. After reading it I both agree and partly disagree with you.

On the matter of the semantics for aside being on the block level, I agree. Regions can contain collections of blocks and other content and it would be wrong to mark them up as asides. Each block represents a contained chunk of data which can rightly be considered an aside.

However, I think that you could raise a reasonably strong case that "almost" all blocks could be considered as asides, no matter what the content. The text is quite inclusive as what can be included in an aside:

The element can be used for typographical effects like pull quotes or sidebars, for advertising, for groups of nav elements, and for other content that is considered separate from the main content of the page.

The examples given are also quite inclusive as well and cover: background material, pull quotes, blogrolls and feeds - either inside or outside the article. It seems that any block chunk could therefore be an aside. The one exception to this would be if you had a block which very much at the heart of the subject matter for the resource. So yeah, its possible, but I'd say the majority of blocks could be asides.

Getting back to your main point, I agree it's at the block level. A semantic flag on blocks ("is_aside", default=true) would be a good way to do it.

If we are talking semantics maybe we should also start thinking about blocks being able to produce their own RDFa as well. This would allow robots to collect not just the "core" RDFa for the resource in question, but lots of "tangential" graphs off to the side. This would make it less resource intensive on robots and web servers.

Quick idea: views could be associated with a "predicate". The items listed are the objects. The "context" object (view argument) is the subject. The views template just needs to know how to pump RDFa for the items. Then you would have blocks with semantics :) at least where the listing of items was concerned.

Thanks again for the article. Got the juices flowing.

Jeff Burnz's picture

...

its possible, but I’d say the majority of blocks could be asides

The key words are "tangentially related", the blogroll and tweets are pretty good examples - they are "somewhat" related. I think there is a very clear distinction between say a menu and a blogroll, clearly the menu is nav, so we choose the better tag for the job, in the spec example we see they use footer and nav for the contentinfo type elements, section seems like a more likely generic candidate for blocks, a catch all replacement for our current div wrapper.

I like your ideas about blocks, sounds like a conversation we can have with the RDFa team, and Views being able to pump in RDFa would be extremely powerful, cool ideas, that's got my juices flowing now!

rock_benim's picture

nice comment

hmmm.. for thanks your comment is very good.........

Peter Lawlor's picture

Articulation is important

I'm not a huge Drupal user, but I'm into CMS big time and one of the difficult issues that arise over and over is terminology ... more specifically inconsistent terminology. I blog about CMS and I do my best to communicate clearly in tutorials etc. but in many aspects there are different terms used for the same meaning. The problem that arises is that readers become confused. They think are they referring X or to Y. I can see the same issue arises with Drupal and the Aside vs Sidebar terminology.

Samantha Scotter's picture

Drupal Makes Things Easier

Thanks for this post. Cheers!

Get a Job's picture

Drupal is definitely the way

Drupal is definitely the way to go, at least for me coming from wordpress