I'm teetering on the brink of using HTML5 in my Drupal themes. But I'm struggling with correct usage of Article tags.
The context in which I'm having a problem is when we're displaying a full node page. The natural place to use an Article tag would be for the element with class="node" in node.tpl.php. The problem is this leaves out the Article's title and tabs, which are both part of the article (in my view), but are dealt with by page.tpl.php rather than node.tpl.php.
I can think of two approaches to tackle this problem:
- In page.tpl.php, detect if we're looking at a node, and if we are, wrap the page title, tabs and content in an Article tag. Also, in node.tpl.php, wrap the teaser title, node content and links in an Article tag if we're looking at a teaser, but in plain Div tags if we're looking at a full node display.
- Alternatively, remove the page title and tabs from page.tpl.php if we're looking at a node display, and move them into node.tpl.php - inside the Article tag.
The first approach seems doable, but rather messy. The second seems neater, but I'm not even sure it's possible to access tabs from node.tpl.php.
Any suggestions or advice here?

Comments
option 2
I've just done option 2 (for different reasons), but only for the page title. Tabs then appear above the title - since only admin users see them on my site that was fine, your needs may be different :)
I'm using the second option
I'm using the second option as well and have completely removed the tab. Instead I use contextual menues. Which I've hooked in with:
function HOOK_node_view_alter(&$build) {if (!empty($build['#node']->nid)) {
$build['#contextual_links']['node'] = array('node', array($build['#node']->nid));
}
}
function THEME_preprocess_html(&$variables) {if (user_access('contextual links')) {
drupal_add_library('contextual', 'contextual-links');
}
}
I also wanted to have the translate link visible in the context menu and used the following alter hook to accomplish it. This can be used to add other links as well.
function HOOK_menu_alter(&$items) {$items['node/%node/translate']['context'] = MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE;
}
Thanks, adrinux and oxyc
Nice trick, using the contextual menu. I'd be inclined to leave tabs there for admin pages. But the contextual menu could certainly come to the rescue on main node pages. It would make the UI much more streamlined too.
The only snag is that I'm working on a base theme, which by its nature needs to be generic. The contextual menu route seems good for a specific site, but complex to implement as a good generic solution.
Is it possible to access the normal tabs array inside a node context? Thinking aloud, perhaps I could check if we're looking at a node in template.php, and if we are, package up the $tabs variable and pass it through to node.tpl.php...
HTML Base theme - Inspriration
Hey Mark,
Have you checked out Boron? I like how it handles the Title and tabs on the node.tpl.php
It might be worth taking a peek at and could help inspire you in your themes development.
Yes, I've checked Boron
Boron puts article tags around the node in node.tpl.php, and it leaves the Title and Tabs outside the article. The Boron guys are clearly pragmatists and not anally retentive like me :)
Opps, you are right!
ugh. After a full cup of coffee in my system, I see you are right.
Sorry about that- I must have looked at it wrong last night.
Option two is attractive and
Option two is attractive and with some thought doable, thinking there are many pages that are not nodes, so testing for node is then required for all other pages, so to speak. Certainly title within article is a requirement for a proper outline, some rethinking for Drupal core and how we do this is needed, e.g. should page title be handled by page.tpl.php at all?
Option one is interesting and probably more along the lines of an actual solution, maybe not strictly as described here, but tending in the right direction, perhaps in terms of a universal template for the display of "the main content" with control over the actual markup that wraps it, with some mechanism for modules/functions to dictate what that might be.
The only possible solution is
The only possible solution is the option one.
And why?
Cos every content has to be wrapped into an article and there arent just nodes only. There are views, users, custom pages etc. The only thing we can examine in node is whether the node is teaser or not cos if teaser then it should be an article but this doesnt mean that the main article can be skipped. So in this case page will look like this:
<article><h1>Main tile</h1>
// Node teasers
<article></article>
<article></article>
<article></article>
// Node teasers end
</article>