In a somewhat similar situation I used PHP with `include`.
The structure was something like this:
- index.php
- header.php
- sidebar.php
- footer.php
- page-1.php
- page-2.php
...
In `header.php` I used variables for the title, description, etc. and then in each page I specified the values for those variables. This way each page had the same header HTML code, but with a different title, description and so on.