logoalt Hacker News

fergie • today at 5:56 AM • 7 replies • view on HN

W3C: Why can't we just have <includes src="./header.html"> and be done with it?


Replies

tannhaeuser • today at 7:04 AM

SGML (ISO 8879), the markup meta-language on which HTML is based, has that, as well as many other things, such as type-checked templating.

Hence HTML as a mere vocabulary making use of SGML's facilities didn't need to define its own ad-hoc mechanism.

Btw the <?php ...> construct is also derived from SGML. In SGML terms it's a "processing instruction" rather than an "entity reference", the latter being the basic means for content inclusion.

pautasso • today at 6:42 AM

Nice idea!

https://web.dev/articles/imports

Been there, tried that.

Introduced in 2014 (Chrome 36) Deprecated 2018 (Chrome 70) Retired 2019 (Chrome 73)

icedchai • today at 3:55 PM

In the old days, we used to emulate this with a <script> tag that did a document.write ... yes, very hacky.

jrimbault • today at 6:11 AM

<?php include "header.html" ?>

➕ show 2 replies
geoffmunn • today at 7:16 AM

Can I introduce you to iframes? Clunky but they do exactly what you are asking for.

➕ show 1 reply