The #W3C html-xml-utils have been in development since 2004, and if you're building a static website on a #Unix system they're still useful.
#hxinclude will let you include HTML partials using syntax reminiscent of #Apache #ServerSideIncludes.
#hxtoc will let you generate a table of contents for a page.
#hxnormalize is a lightweight version of #tidy if all you want is pretty markup.
There's lots more, and you can pipe them in a script. (I should blog about this...)
#tidy #hxnormalize #hxtoc #serversideincludes #apache #hxinclude #unix #w3c