0

I understand and what I have seen the most is the use of the article element for blog/news posts. This makes total sense to me. article element to be used for content that can stand alone or syndicated.

However, when looking at the underscores starter theme it uses the element to contain the content on Pages as well. For example:

<main>
<article>

//content here

</article>
</main>

Where what I have seen the most and what I would likely do is something like:

<main>
<section> (or div)

//content here

</section> (or end div)
</main>

Which is more correct, or possibly more flexible? I was thinking that some things that go on a page might not qualify as an article..? For example you may build out a layout using short codes. Would all that belong in an article element?

1
  • This is about html5, not wordpress...
    – cjbj
    May 21, 2016 at 14:34

1 Answer 1

2

1. By definition

The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g., in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.

The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content.

Note 1 Authors are encouraged to use the article element instead of the section element when it would make sense to syndicate the contents of the element.

So, if the content here is related stuffs but isn't completeness, wrap them inside section element. If the content here is a related stuffs and is completeness, wrap them inside article element.

Then, in the context of original _s theme, article is more correct.

2. By flexibility

article elements are nested, the inner article elements represent articles that are in principle related to the contents of the outer article. For instance, a blog entry on a site that accepts user-submitted comments could represent the comments as article elements nested within the article element for the blog entry.

For section element, the content of inner section element doesn't relate to the content of the outer section element.

Note 1 When used specifically with content to be redistributed in syndication, the article element is similar in purpose to the entry element in Atom. RFC4287

Note 2 The schema.org microdata vocabulary can be used to provide the publication date for an article element, using one of the CreativeWork subtypes.

The section element has more aria role attributes than article element.

So, which's more flexible? None, it depends on the content inside each element and the context they're in.

Bonus from w3schools:

Newspaper: The sports articles in the sports section, have a technical section in each article.

1
  • Thank you. Yes more HTML 5, but I posted in Wordpress because I thought it involved how you template and create structure in a theme . May 21, 2016 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.