0

This is my website, https://unrealcousinzzz.com/.

I made it in HTML, CSS, and JavaScript. I cannot use PHP or anything like that right now because I am hosting it in AWS S3, because lightsail is too expensive for me. On each page in my website, I use the same HTML code. For example, every page has code for my navbar, and code google AdSense.

If I want to change these, I would have to do it on every page right now. Is there a way to make a file that other HTML pages will read, and use that where it is placed in that page?

brian d foy
  • 129,424
  • 31
  • 207
  • 592

2 Answers2

0

HTML itself doesn't have any sort of templating, but there are alternatives.

Use something on your dev machine to compile your HTML for you. I use a Node.js script and a JavaScript template engine for this. Basically, I write out my templates, run the script which generates the HTML, and then I upload it to the S3 bucket.

It doesn't have to be done with Node. You could use PHP with this same method. Or, a Bash script for that matter.

Brad
  • 159,648
  • 54
  • 349
  • 530
0

Ok, so for me google tag manager is good. I can add custom html, and it goes onto all of my pages.