I have a static site hosted on GitHub Pages which is starting to grow in size. Normally I would use server side includes (
Use templates and preprocess them at build time (as opposed to run time). You could set them up to build as a git commit hook.
There are a lot of tools for doing this listed here, I'm fond of ttree.