HTML itself doesn't provide such a mechanism, though SGML, the language in which the HTML element vocabulary is/was originally specified, does in the form of entities/entity references. Using SGML entities, you'd typically create an SGML file containing just your menu, and then pull-in that file from multiple individual page content files:
<!-- content of menu.sgml file -->
<nav>
<ul>
<li><a href="about.html">About</a></li>
<li><a href="blog.html">Blog</a></li>
<!-- ... further menu items -->
</ul>
</nav>
<!-- content of page.sgml pulling-in menu.sgml -->
<!DOCTYPE html [
<!-- this declares the "menu" entity -->
<!ENTITY menu SYSTEM "menu.sgml">
]>
<html>
<head>
<title>Menu demo</title>
</head>
<body>
<!-- this pulls-in menu.sgml as if it were part
of page.sgml directly -->
&menu
<main>
<h2>Heading</h2>
<p>Main content of your page</p>
</main>
</body>
</html>
Now you'd only edit menu.sgml
and have your updated menu content always up-to-date in any page files referencing menu.sgml
. You can even leave out the declaration for menu
(and the whole DOCTYPE
document prolog) since SGML resolves the &menu
entity reference to a file of that name in the same directory as the referencing file by default.
Note: browsers don't implement SGML. To make use of SGML in browsers (and/or on the server side as well when using node.js), you can use my sgmljs.net SGML parser/lib; see http://sgmljs.net/docs/sgmlrefman.html#general-entities for discussion of relevant entity techniques.
Commonly used server-side template libs such as Jade, pug, handlebars, mustache, etc. all have their own mechanisms called partials or includes to get functionality more or less equivalent to SGML general entities.