Most of the news articles I've seen are peppered with HTML elements containing unrelated content that
- weren't written by the author,
- don't semantically belong to the story,
- are only there for marketing or other purposes, and
- they can mess up accessibility (e.g., screen reader navigation).
Thus, these should be probably placed at a different place in the HTML markup.
How would it be possible to visually mix these unrelated content with the article text while still keeping the semantic integrity of the HTML markup?
For example, have a <div>
container somewhere in the HTML markup containing the ads (or anchors to generate the ads dynamically), and visually intersperse them with the <p>
's of the <article>
. (That is, don't reorganize the DOM but render elements in other places that would achieve the same effect, as if those elements were included there in the DOM.)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Article title</title>
</head>
<body>
<main>
<article>
<h1>Article title</h2>
<p>...</p>
<h2>Subsection</h3>
<p>...</p>
<p>...</p>
<h2>Another subsection</h3>
<p>...</p>
</article>
<aside>
<h2>Related articles</h2>
<ul>
<li><a href="#">It never stops raining</a></li>
<li><a href="#">Oh well...</a></li>
</ul>
</aside>
<div id="ad-container">
<div class="ad">Tis an ad</div>
<div class="ad">Yet another ad</div>
</div>
</main>
but render it so:
Article title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Donec a diam lectus. Set sit amet ipsum mauris. Maecenas congue ligula as quam viverra nec consectetur ant hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur.
Related articles
- It never stops raining
- Oh well...
Subsection
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Donec a diam lectus. Set sit amet ipsum mauris. Maecenas congue ligula as quam viverra nec consectetur ant hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur.
AD BLOCK: Tis an ad.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Donec a diam lectus. Set sit amet ipsum mauris. Maecenas congue ligula as quam viverra nec consectetur ant hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur.
Another subsection
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Donec a diam lectus. Set sit amet ipsum mauris. Maecenas congue ligula as quam viverra nec consectetur ant hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur.
AD BLOCK: Yet another ad.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Donec a diam lectus. Set sit amet ipsum mauris. Maecenas congue ligula as quam viverra nec consectetur ant hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur.