PHP is the best way to make a template that dynamically creates files for your website. You create one template file, and insert code into each of your PHP files that reads the template and creates the document around the data.
Javascript (.js files) is a horrible idea, but one I used to do… it works the same way. However, thats client side, and its more secure/better to do server side page generation via php. If you are running your own server, its easy to install the PHP module, and if you are being hosted ask your hosting company if they have PHP capabilities.