Unorthodox Use Of Html5 Nav Tag
Solution 1:
I guess the only thing that could happen is that web crawlers (such as googlebot) will treat those as navigation sections. what the actual meaning of this we could only tell if someone from google will reveal to us some secrets...
Things to consider:
Reading the nav tag specs:
Browsers, such as screen readers for disabled users, can use this element to determine whether to omit the initial rendering of this content.
for article the specs says:
An article should make sense on its own, and it should be possible to read it independently from the rest of the web site.
Examples of where an element can be used:
Forum post Blog post Newspaper article
So.. If it was me I would put the whole thing (all articles) inside <main></main> tag and create separate <article> for each article. for the comments I would use <aside> too, also for the links I would use <nav> just like you did, but maybe someone else have better solution.
Solution 2:
Following the HTML5 specification allows various user agents to "present and use documents and applications in a wide variety of contexts that the author might not have considered." (HTML5, Semantics).
If you’re not using the most specific elements available, or if you’re using elements not according to their definitions, it’s possible that some user agents fail to do whatever their job is.
If these are "practical consequences" for you can’t be answered, because it depends on what you care about, and on which user agents do and will consume your documents (which is impossible to know).
For example:
The
articleelement is defined to represent, among other compositions, a "user-submitted comment".
The spec even explicitly mentions the case for a blog post’s comments, which could be represented "asarticleelements nested within thearticleelement for the blog entry."It is conceivable that, for example, a comment-processing user agent will look for (or even depend on) this markup.
And by not following the spec here (not using
articlefor comments), you can’t use other features of HTML5, or its extensions, that are based on using appropriate elements. For example, if you’d nest yourasideelements (representing the comments) in thearticle(which should be done, as they are related to thearticle, not the whole document):You could not use the
addresselement for providing thearticleauthor’s contact information. If you’d usearticle(as intended), each one (this means, the original post as well as each comment) could have its ownaddress.You could not use the
authorlink type for the commenting user’s website, as this applies to the "nearestarticleelement ancestor" (so the commenting users would be considered authors of your post).
While using the
navelement for "related links" is not wrong (its actual definition is pretty broad), I think it’s counterproductive to do this.If the links are related to the
article, they should be nested in thisarticle. Usingnavhere would convey the wrong meaning: it’s not the navigation for thisarticle, right? Instead ofnav, here using theasideelement seems to be appropriate.For sites that don’t have a classical menu, the pagination is typically the primary navigation.
And think for example about screen reader users: they might use a feature to jump to the page’s navigation (e.g., to get an overview of the site, to learn what is available). Even ignoring the fact that having multiple, scattered
navelements might make this harder, how useful would it be to listen to a list of a few (not even all) post titles, which are typically longer than what’s ideal for a site navigation? And on top of that, this navigation likely even changes from page to page, so the users would have to do it again and again, skipping through possibly many duplicates.
tl;dr: Unless you have very good reasons, follow the definitions from the spec. Better use meaningless elements (div, span, in some cases section, etc.) instead of "reinterpretting" other elements which you can’t use according to their defined meaning or their intended purpose.
Post a Comment for "Unorthodox Use Of Html5 Nav Tag"