Use append to add block of code to different html files

I am wondering if I can use append to add a template literal (a block of code) to different html files. E.g., let’s say I have a couple of html files ( about.html, projects.html, contact.html) and they all share the same <header>...code here...</header> and <footer>...code here..</footer>, instead of manually adding these block of codes in each one of the html files, can I do this with JS somehow ?

Without more details, I can only say, yes you can.
Check out mozilla for developers for more details.

I edited my post, basically I have a block of code in the header and footer section that I would like to add to different html files, and I was wondering if I can do this with JS instead of manually adding these block of codes in each of the html files.

yes, you can do that with vanilla js or you can use some library, like ejs … it is perfect for what you are trying to do…
http://ejs.co/

I can’t do this on my local-host? I can’t use this trick for me development work then.

Yes I am. Perfect then! thanks again @camperextraordinaire

One more question, would this be consider a good practice or would you say it’s better to insert the code in the html files? I just think having a general controller like your example is better for maintainability.

That’s what I thought, thanks for your help.