I am very new to HTML5 and I need to implement an article container (for example, I need to create the classic structure for the WordPress articles where the user see a series of articles one below another), but I have some doubts about the semantic use of the new HTML5 components.
To do this I thought something like this:
<section>
<h1>My Posts:</h1>
<article>
<header>
<time datetime="2010-11-10" pubdate>10/11/2010</time>
<h2>FIRST POST TITLE</h2>
</header>
<p>
POSTS CONTENT
</p>
<footer>
<address><a href="mailto:nonesiste@non.st">MY NAME</a></address>
</footer>
</article>
<article>
<header>
<time datetime="2010-11-01" pubdate>01/11/2010</time>
<h1>SECOND POST TITLE</h1>
</header>
<p>
POSTS CONTENT
</p>
<footer>
<address><a href="mailto:nonesiste@non.st">MY NAME</a></address>
</footer>
</article>
</section>
So I have reasoned in the following way:
- All the shown posts are contained in an external
<section>
element (because following the HTML5 specification a<section>
represents a generic section of a document, in this case an area where posts are shown), the<sections>
have its<h1>
title. - Every post is represented by a specific
<article>
element (should be semantically correct). - Every article element represents a specific post and contains a
<header>
element that contains the date of publication and the post title. I used a<header>
element to contain these information because this element is used to represent "a group of introductory or navigational aids". - Then I have a classic
<p>
to contain the article textual content (but I can also wrap it into a div or is it better use a new<section>
if the text is long and detailed?) - Finally I have put the e-mail contact into a
<footer>
element because it is an information about the container (the<article>
element).
Is this a valid structure for my problem? Is it semantically correct in HTML5?