Remix.run Logo
▲ fergie 4 hours ago

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

▲pwdisswordfishq 2 hours ago | parent | next [-]

We do.

https://www.w3.org/TR/xinclude/

https://www.w3.org/TR/xinclude-11/

▲pautasso 3 hours ago | parent | prev | next [-]

Nice idea!

https://web.dev/articles/imports

Been there, tried that.

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

▲tannhaeuser 3 hours ago | parent | prev | next [-]

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.

▲cton 4 hours ago | parent | prev | next [-]

You might be interested in https://github.com/WICG/declarative-partial-updates

▲jrimbault 4 hours ago | parent | prev | next [-]

<?php include "header.html" ?>

▲fergie 4 hours ago | parent | next [-]

Yes, but then you need php

Why is there no direct support for templating in HTML itself?

▲messe 4 hours ago | parent | prev [-]

    <!-- #include file="header.html" -->
https://en.wikipedia.org/wiki/Server_Side_Includes
▲fergie 4 hours ago | parent [-]

SSIs are not widely supported any more, and were never a part of the HTML standard

(but yes- I used these a lot like 25 years ago)

▲jonatron 24 minutes ago | parent [-]

From what I can tell, apache mod_include and nginx SSI are still included by default?

▲geoffmunn 3 hours ago | parent | prev [-]

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