HTML 5 Needs A File Include Tag

HTML
While sitting here writing up some static HTML 5 pages, I noticed something - I was repeating my markup over and over again. I wondered to myself why HTML 5 doesn't have an include file tag. Wouldn't there be much more to gain by having this in the name of reusability?

By default, files would be relative from the base. When the user agent sees the include tag, it loads the file. The documents themselves would be snippets of html. The user agent can only pull these documents off the website. This, to avoid document reuse from other websites.

Imagine the possibilities.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html"/>
<link rel="stylesheet" media="screen" href="screen.css"/>
<base href="http://www.mysite.com"/>
</head>
<body>
  <include src="header.html"/>
  <include src="nav.html"/>
  <include src="sidebar.html"/>
  <include src="/cms/articleEngine.php" param="viewType=2"/>
  <include src="footer.html"/>
</body>
</html>
header.html
----------------
<header>
<img src="/images/logo.png" alt="Logo"/>
</header>
nav.html
------------
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="about.html">About</a></li>
</ul>
sidebar.html
----------------
<aside>
<div id="register">
<include src="registerForm.html"/>
</div>
<div id="ad">
<include src="googleAd.html"/>
</div>
<div id="clock">
<include src="http://www.time.gov" params="current&date"/>
</div>
</aside>
footer.html
---------------
<footer>
<p>Copyright &copy; MySite.com 2011. All rights reserved</p>
</footer>
/cms/ArticleEngine.php
-------------------------------
ArticleEngine($_GET['param'], $numArticles=4);

ASO ad


Filed under: