3 ms·
HTML itself doesn't have it because HTML was understood to be an SGML application/vocabulary, and SGML does have mechanisms for fragment inclusion/sharing. For
by tannhaeuser 2y ago
HTML itself doesn't have it because HTML was understood to be an SGML application/vocabulary, and SGML does have mechanisms for fragment inclusion/sharing. For your requirements (pretty much the simplest case), you'd use entities:
<!doctype html [
<!entity hdr system "header.html">
...
]>
&header <!-- content of header.html gets included here -->
... page body content goes here ...
SGML can also take care of inferring omitted <html>, <head>, and <body> tags here.
Moreover, you can also use more sophisticated entity expansion and template mechanisms with type checking, proper HTML-aware auto-escaping (for things such as potentially malicious user-provided comments), table-of-content/nav generation, etc. etc.