Live data from Hacker News

Why can't HTML alone do includes?

frontendmasters.com

21–30 of 367 posts

Re: Why can't HTML alone do includes?

#21
I think this is a genuinely good question that I was also wondering some time ago.

And it is a genuinely good question!

I think the answer of PD says feels the truest.

JS/CSS with all its bureaucracy are nothing compared to HTML it seems. Maybe people don't find nothing wrong with Html, maybe if they do, they just reach out for js/css and try to fix html (ahem frontend frameworks).

That being said, I have just regurgitated what PD says has said and I give him full credit of that but I am also genuinely confused as to why I have heard that JS / CSS are bureaucratic (I remember that there was this fireship video of types being added in JS and I think I had watched it atleast 1 year ago (can be wrong) but I haven't heard anything for it and I see a lot of JS proposals just stuck from my observation

And yet HTML is such level of bureaucratic that the answer to why HTML doesn't have a feature is because of its bureaucracy. Maybe someone can explain the history of it and why?

Re: Why can't HTML alone do includes?

#22
post #8

Have you ever heard of Server Side Includes? https://en.wikipedia.org/wiki/Server_Side_Includes

After researching this very topic earlier; SSI is the most pragmatic solution. Check out Caddy's Template Language (based on Go), it is quite capable and quite similar to building themes in Hugo. Just much more bare bones.

I have built several sites with pure HTML+CSS, sprinkled with some light SSI with Caddy, and it is rock solid and very performant!

Re: Why can't HTML alone do includes?

#25
post #16

My guess: no-one needs it. Originally, iframe were the solution, like the posts mentions. By the time iframes became unfashionable, nobody was writing HTML with their bare hands anymore. Since then, people use a myriad of other tools and, as also mentioned, they all have a way to fix this. So the only group who would benefit from a better iframe is the group of people who don't use any tools and write their HTML with…

what if it could be a larger group though? modern css has been advancing rather rapidly... I don't even need a preprocessing library any more... I've got nested rules, variables, even some light data handling... why not start beefing up html too? we've got some new features but includes would be killer

Re: Why can't HTML alone do includes?

#26
I guess for the similar reason that Markdown does not have any "include" ability -- it is a feature not useful enough yet with too many issues to deal with. They are really intended to be used as "single" documents.

Re: Why can't HTML alone do includes?

#29

The simplest answer is that HTML wasn't designed as a presentation language, but a hypertext document language. CSS and Javascripts were add-ons after the fact. Images weren't even in the first version. Once usage of the web grew beyond the initial vision, solutions like server-side includes and server-side languages that rendered HTML were sufficient.

I think the best examples of HTML in that regard is HTML-rendered info pages[0], for Emacs and its ecosystem. Then you have the same content presented in HTML [1]. Templates were enough in the first case. Includes are better in the second case due to common assets external to the content.

[0]: https://www.gnu.org/software/emacs/manual/html_node/emacs/in...

[1]: https://emacsdocs.org/docs/emacs/The-Emacs-Editor

Post reply on HN