Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I agree with other answers that a static site generator is the best approach. This is something that the original designers of HTML left as an open problem. The problem has now been "solved" by thi...
Answer
#1: Initial revision
I agree with other answers that a static site generator is the best approach. This is something that the original designers of HTML left as an open problem. The problem has now been "solved" by third party tools, and there's not yet a good alternative to HTML. Static site generators are those tools. HTML does not support includes, so indeed in vanilla HTML you are expected to duplicate the content on each page. In theory, you can make the common content a separate page, and display it in a frame. This would have several drawbacks, one of them being that you can't have the footer be slightly different on each page (like highlighting the current page). You could author your documents in some other format (that supports includes), and then compile them. Python's Jinja library can do this, as can Pandoc, and many others. However, you would be reinventing the wheel, since static site generators are already a mature implementation of this idea. These days many sites generate the HTML both client and server side. The server (for example, Python Flask) can calculate each part of the page dynamically when serving each visitor, then compose them together. On the client side, Javascript can further modify the HTML. Sometimes the server just sends over data packets (like JSON) instead of HTML, and it gets rendered into HTML by client side JS. This is a popular approach in commercial frontends, but likely not worth the effort for you unless you want to make a webapp.