Recently I've come to notice some people use <header>
, <main>
, <footer>
tag, inside an <article>
tag to determine the parts of an article. I want to know if this is right. Is it helpful for the search engine to optimize?
trying to find an answer.
CodePudding user response:
Whether it's "right" or not is answered by the HTML specification, which states that the allowed content for an article
element is flow content. This includes all the tags that you mentioned (header
, main
, footer
).
There are however limitations when it comes to the use of the main
element as it has a distinct set of allowed ancestor elements, which does not include article
.
The specification has an explicit example of an article
with header
and footer
elements, yet no main
element.
Whether it's helpful for search engines is an entirely different matter, and feels like a question that cannot be answered without gathering some evidence comparing the behavior of various search engines.