Sinthia V
Sinthia V

Reputation: 2093

What is the semantically correct container for a sideber widget in html 5?

I have a page with no textual type content at all. It is a jquery header, two sidebars and a footer. The secondary sidebar is a dynamically generated column of plug-in Wordpress widgets.

The sliders I love are html5, so I am taking the plunge. Here is the xhtml version:

// Area 4 home secondary
register_sidebar( 
    array (
        'name' => 'Home Secondary Widget Area',
        'id' => 'home_secondary_widget_area',
        'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
        'after_widget' => "</div>",
        'before_title' => '<h3 class="widget-title">',
        'after_title' => '</h3>'
     ) 
);

This then parses to:

<div id="primary" class="widget-area">
    <ul class="xoxo">
        <li id="search-2" class="widget-container widget_search">
          <form role="search" method="get" id="searchform" action="http://localhost/wordpress_testbed/" >
            <div>
                  <label class="screen-reader-text" for="s">Search for:</label>
              <input type="text" value="" name="s" id="s" />
              <input type="submit" id="searchsubmit" value="Search" />
            </div>
       </form>
         </li>      
         <li id="recent-posts-2" class="widget-container widget_recent_entries">            
           <h3 class="widget-title">Recent Posts</h3>       
           <ul>
            <li><a href="http://localhost/wordpress_testbed/?p=1" title="Hello world!">Hello world!</a></li>
            <li><a href="http://localhost/wordpress_testbed/?p=358" title="Readability Test">Readability Test</a></li>
            <li><a href="http://localhost/wordpress_testbed/?p=188" title="Layout Test">Layout Test</a></li>
            <li><a href="http://localhost/wordpress_testbed/?p=128" title="Images Test">Images Test</a></li>
            <li><a href="http://localhost/wordpress_testbed/?p=555" title="Post Format Test: Gallery">Post Format Test: Gallery</a></li>
          </ul>
        </li>
    </ul>
</div>

How should the widgets be marked up? Bonus would be a title mechanism.

Upvotes: 2

Views: 383

Answers (1)

Phil Nelson
Phil Nelson

Reputation: 21

It is totally acceptable in this situation to use <aside>, as referenced here: http://html5doctor.com/aside-revisited/

Your HTML will work just fine and validate as HTML5. I'd suggest something simpler, like this:

<aside>
    <section>
        <h2>Item Title</h2>
        <ul>
            <li>Some Items</li>
        </ul>
    </section>
</aside>

Upvotes: 2

Related Questions