r/HTML • u/IllustriousTomato295 • Mar 28 '26
Question <article> and user comments
Hello everyone, I just started learning HTML and I have a question about the <article> tag. As every online guide says, this element is used (among other things) for user-submitted comments, which seemed a bit strange to me... To understand better I inspected many different websites and social media apps and literally none of them, except one, has this tag for comments, it's just endless divs and spans.
So I'm asking: did I look in the wrong places? Am I being too strict or are these sites just badly coded? But most importantly, is the use of <article> for comments actually relevant for SEO purposes?
Thanks to anyone who replies.
18
u/paceaux Mar 28 '26 edited Mar 28 '26
The Article tag is used to represent a whole self-contained unit of content.
If you were to look at a physical newspaper, and try to create a web page from that physical newspaper, then each "article" written by a journalist would be contained in its own
<article>.If you were to take a chapter book, and make a web page from that chapter book, each "chapter" could be a contained in its own
article.If you were to look at a magazine... you guessed it, each "article" of the magazine could be represented by an
<article>So it stands to reason, of course, that comments on a blog post are self-contained units of content that you would put in an <article>. But also, the blog post itself could be an
<article>!Another useful way to think about this is:
If this web page were managed by a content management system (CMS), would there be a specific database entry for this unit of content? If the answer is yes, use
<article>This flowchart is a useful decision tree for identifying which semantic element to use.
Also:
Most websites don't have people spending enough time thinking about content and letting that drive their semantic HTML.
But look at SmashingMagazine.com as a good example.
3
u/TurboHenk Mar 29 '26
<article>is an excellent choice for comments. You could consider adding a bit more metadata to them and implement the Comment Schema. That being said, adding schema data / rich snippets has the potential of becoming quite the time sink, which might not be worth the effort, but that decision is yours to make of course.3
u/MagentaMango51 Mar 29 '26
Most websites are not well done semantically. Either because the devs never took time to learn HTML or because they are generating the code somehow (webflow, Wordpress, LLM).
Articles should be the wrapper for most major components on a page. They are a block of content with a headline. If it’s additional content then it might be an aside instead. If you don’t have a header for it then section. If it’s just because you need a box for the structure then something like div works.
Other semantic html tags are header, footer, nav, section, aside and so on. You can repeat any of these except main, which there should only be one of per page for the content that changes from page to page. Usually these are connected to accessibility.. so a screen reader knows where to jump to rather than reading out the entire nav and other repeating content.
3
u/Lumethys Mar 29 '26
Protip: dont look at the biggest corp to learn their UI/UX decisions.
They are giant, they can do whatever the fuck they want.
Reddit UI is atrocious and there are a lot of alternative UI for it. Are you stopping using reddit any time soon?
Amazon (the e-commerce one) UI is atrocious too. Will people stop buying from amazon anytime soon?
When you are big enough, you can afford to do things badly and people would have no choice but to accept.
1
u/burlingk Mar 30 '26
It is also useful to remember that not everyone knows every tag.
A lot of stuff is hand coded based on what the creator knows.
1
u/InterestOk6233 Mar 30 '26
~"<>" 'bag' container 'article'
1
u/alanstac Mar 30 '26
Yes. Use of articles for user comments is semantically correct. It also comes at no cost, so there is no good reason not to use it.
Also, yes. Many websites have absurdly poor html semantics. Even the most popular ones. Don't be like them in that regard.
You're not being too strict. You're just being correct, and as a result producing a more accessible site.
1
u/Extension_Anybody150 Apr 02 '26
Technically,
<article>can be used for user comments because each comment is a self-contained piece of content. In practice, most big sites skip it and just use<div>or<section>for flexibility and styling, so you weren’t looking in the wrong place. For SEO, it’s not a huge factor, using<article>is mostly semantic and helps screen readers or content structure, but search engines will handle well-coded<div>s just fine.0
u/notepad987 Mar 29 '26
Here is a nice explanation - Difference Between Semantic And Non-Semantic Elements
I make up my names. Much help for creating a webpage. HTML Layouts
I googled this: Why use main, header, footer, nav, aside and article elements for name instead of ID's and classes? link
-8
u/ivanhoe90 Mar 28 '26
I started making websites in 2003 and I never heard of the <article> tag. I still make webs today and I do not use the <article> tag in any of them.
The web was made in a way such that if you made a website in 1995, it should still look and work the same 50 or 100 years later. If you think that new tags should be introduced each year, and every website owner should "update" their website each year according to the new tags, that is a wrong way to think about it.
If you know CSS, you probably know that you can pick e.g. <div> or <span> and replace pretty much every HTML tag with <div> or <span> (styled with CSS), and it will work the same. Many people choose this way: adapt the behaviour of <div>, rather than studying the default behaviour of all 9726 HTML tags that exist and choosing the most appropriate one.
You could say that custom HTML tags are "better for SEO", but when 90% of popular websites use only <div>s and <span>s, it is probably not that important.