Newbie question re: the repetitive HTML code when adding items to a menu

Hello! Please take a look at my site here: Test Multipage Site

This is just a simple site with a three-item menu. If you look at the source code, you’ll see that the HTML for the menu sidebar section is exactly the same throughout all four .htm files (index.htm, item1.htm, item2.htm, and item3.htm):


<div id="navigation">
	<ul>
		<li><a href="item1.htm">Item 1</a></li>
		<li><a href="item2.htm">Item 2</a></li>
		<li><a href="item3.htm">Item 3</a></li>
	</ul>
</div>  

So this means that if I want to add another item to the menu, I will have to change the HTML of every single other .htm file. And I have to make sure that the HTML of all the files are exactly the same, to maintain consistency. This is a pain, especially as more and more items get added to the menu. My question is: Is there a better way to do this?

Yes indeed. There’s a thing called “includes”, which are very easy to do, meaning that you have the code in one place and link to it from each page. Here’s a little page I wrote up on it recently, showing one way to do it:

Enhance Your Site With PHP Includes

And it is likely to need even more file editing as the site grows. You are wise to spot this early on.

If the pages are static HTM(L) pages there isn’t much you can do about it.

But I’m guessing your host has some kind of server-side language available no?
Got PHP?

It would be a rare (and utterly lame) web host that didn’t have PHP available.