In the following example html5 page structure, which of the following is more semantic in respect to the sidebar of widgets (elements which appear in the sidebar are elements which appear on multiple pages and do not necessarily, directly, nor particularly relate to this page of content):
<body>
<header id="site-header">
...
</header>
<section id="page-body">
<main>
<header></header>
<article></article>
<footer></footer>
</main>
<aside class="sidebar" id="sidebar-a">
<section id="search-widget">
...search field, etc...
</section>
<section id="recent-articles-widget">
...articles list...
</section>
</aside>
<aside class="sidebar" id="sidebar-b">
<section id="cloud-tag-widget">
...search field, etc...
</section>
<section id="recent-articles-widget">
...articles list...
</section>
</aside>
</section>
<footer id="site-footer"> ... </footer>
</body>
or...
<body>
<header id="site-header">
...
</header>
<section id="page-body">
<main>
<header></header>
<article></article>
<footer></footer>
</main>
<section class="sidebar" id="sidebar-a">
<aside id="search-widget">
...search field, etc...
</aside>
<aside id="recent-articles-widget">
...articles list...
</aside>
</section>
<section class="sidebar" id="sidebar-b">
<aside id="cloud-tag-widget">
...tag list...
</aside>
<aside id="popular-articles-widget">
...articles list...
</aside>
</section>
</section>
<footer id="site-footer"> ... </footer>
</body>
AKA - Is it more semantic or in any way more appropriate to put multiple asides within a section, or include multiple sections within an aside to create a sidebar of widgets? Should they instead be simple divs within a div? Or divs within a section? Divs within an aside? Why? Which is easier for screen readers or search engines? Why?
The
<aside>
tag defines some content aside from the content it is placed in.The aside content should be related to the surrounding content.
The
aside
is "tangentially related to the content around" it.Currently, it doesn’t seem to be defined what "around" means exactly. Assuming that it’s (at least) the content of the parent sectioning content element, then this would mean for your examples:
<body> <section> <aside></aside> </section> </body>
The
aside
is related to the content of thesection
.<body> <aside> <section></section> </aside> </body>
The
aside
is related to the content of thebody
(i.e., of the whole document).So in your case, you’ll probably want to have
aside
as descendant ofbody
(and of no other sectioning content element).The next thing to decide would be: one
aside
with several sub-sections vs. severalaside
. I’d go with a separateaside
for each "sidebar block", unless you can logically group (*) these blocks.* I.e., if there is a natural heading that could be used (it doesn’t matter if you actually use it) to group several sidebar blocks, use one
aside
withsection
childs for these.