What is the best way to manage duplicate code in static HTML websites
Out of all the possibilities, both what you listed and anything else I know of, I'd still just run with a simple PHP-based solution. It's easy and clean, requiring next to no effort on your part. I do this with all the small sites I design.
Most often, you end up with fairly trivial structure. You write up a full page, then for each subsequent page you're just changing the bit in the middle where the content lives. In that case, just take everything above and below the content and save it in header.php and footer.php files, then put <?php require_once "header.php"; ?>
at the top of each content file (and similarly with the footer file). Done!
This does have some minor disadvantages. For one, you're depending on scripting, but PHP is the most widely deployed server-side language in the world, so that's not really an issue. You don't even care if it's PHP4 or PHP5, since you're not doing anything fancy.
For two, you're running a script on every page load, in order to serve what is essentially a static file. That slows down your responses, and stresses the CPU unnecessarily. This probably doesn't matter much (the lag is very minor), but if you find it wasteful, there are some good PHP frameworks which will take your PHP-generated pages and generate static htmls out of them for you. (This is easy enough to do yourself, too, with just a bit of work using output buffering.) This way you get the best of both worlds - PHP templates (and the full PHP language if you end up wanting something fancier down the line) but static html pages for minimal CPU activity and fastest page load times.
If you are set on maintaining a static site, I would recommend using a static site generator.
One I have used in the past is webgen
From the webgen page:
The page layout is separated from the content: if you change the layout, all pages that use that layout are automatically updated. You can have any number of different layouts and even nested ones.
Write content in a markup language: The content and layout files can be written in a markup language like Markdown, Textile or Haml which lets you concentrate more on what you write.
Automation: webgen can automatically generate, for example, menus and breadcrumb trails for you.
Dynamic content: It is easy to add some dynamic content if there is a need for it.
You can use a static site generator. I recommend jekyll.