Is an HTML 5 Article tag appropriate for general website documents [closed]

StackOverflow https://stackoverflow.com/questions/19245732

  •  30-06-2022
  •  | 
  •  

Question

Is the <article> tag an appropriate wrapper for site documents, such as "Terms", "Cookie Policy" and "Privacy"? Or should it be reserved for proper articles, such as blogs posts?

Était-ce utile?

La solution

The W3 Spec on the <article> tag

According to the W3 spec:

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.

It then goes on to list some example use-cases for the <article> tag:

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.

Your specific use-case

All that being said, I don't think the tag is really appropriate for wrapping your "terms of service" / "privacy" statements. While those could loosley fit under "any other independent item of content", I don't really think those items conform to the semantics of "a composition that is independently distributable."

Those types of things are very specific to your site, so I would say they don't fit the purpose of the article tag.

Here's a really good blog post on the HTML 5 article tag that I read: The article element

Autres conseils

Yes.

See http://www.w3.org/TR/html5/sections.html#the-article-element

Here is a quote "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."

Article elements are sectioning content ("section" = "part of"). So you shouldn't ever need them to wrap a whole document, regardless of what the content of the document is about.

The appropriate wrapping element for a whole document less the metadata is <body>. The primary text of the document after removing banners, sidebars and footers etc., may be wrapped in a <main> element.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top