How to update footer on all pages at once?

Is it possible to update the footer on all pages of a static website by editing 1 html file?

For example, I built a static website with 5 pages (with 4 html files and one CSS). Right now, to update the footer I have to edit footer code on all 4 html files separately. Is there an easier way to do this?

Here is the website:

Thanks for any help

One option is to add a javascript file with some code, removing the current footer (or the inner content) and adding a new one, yet this will require to add js script on each file.

In pseudo code, something like this:

footer.innerHTML=`new HTML`

Thanks for the suggestion. I haven’t learned JS yet, but that’s the next module.

There should be some other techniques, but probably you need to engineer that before creating the site. For example, you can have head = body =footer as 3 different files, and run a concatenate using bash, or some other tool.

Also maybe pug has some solution, but I don’t know pug.

Another solution is using regex, but this could take some time (it’s javascript too).

The site looks nice though…

1 Like