DEV Community

loading...

Discussion on: 5 reasons to write Semantic HTML

Collapse
nikitahl profile image
Nikita Hlopov Author

What were you using before,

? What makes you confused about ?
Collapse
yujiri8 profile image
Ryan Westlund

I have my articles wrapped in <article>, but the comments outside of it. Maybe I should put <main> around all of them! Although I read something else later the day I posted this suggesting that it's a good idea to put comments inside nested <article>s. Urgh...

Thread Thread
nikitahl profile image
Nikita Hlopov Author

If articles are the main attention section on the page, I think you can wrap them inside . Regarding the comments, honestly, I'm not really sure, but I don't think it's a big issue if you wrap them inside the along with the article itself. :)

Thread Thread
yujiri8 profile image
Ryan Westlund

The reason I started putting comments outside the <article> was an SEO concern. I saw in Google search console that some of my URLs with a query string that caused it to load a subtree of the comments were not having their canonicals URLs respected. I figured it was because not loading the full comment tree made it count as such different content (this happened on pages with a lot of comments) that Google refused to consider them the same page. I thought putting the comments outside of an <article> would help (and it looks like it did).

BTW your comment displays as "I think you can wrap them inside .". I don't know if that was supposed to be "inside <main>"... I think you have to use &lt; to show HTML in dev.to.

Thread Thread
nikitahl profile image
Nikita Hlopov Author

Oh, yea it should be <main> :)
Thanks for noticing.

Thread Thread
zaimazhar97 profile image
zaimazhar97

That's a good insight though, straight off to Google Console now. Thanks. 👍🏽