4 ms·
HTML is not hard its just makes little sense to write a website without some form of templating. If I add a navbar to my website the HTML way to do it is to cop
by baroffoos 7y ago
HTML is not hard its just makes little sense to write a website without some form of templating. If I add a navbar to my website the HTML way to do it is to copy and paste the navbar in to 100 different html files. And then when I want to add a new link to the navbar I have to copy it back in to those 100 files.
Or I could use a static site generator and put it in the navbar file and run a command to have it inserted on every page.
The author of this blog has dealt with this issue by having no site navigation.
- roywiggins 7y agoJust reach back to the other old method: framesets! Well, don't, they're deprecated. But you could. https://www.w3schools.com/tags/tag_frameset.asp https://www.w3schools.com/tags/tag_frameset.asp
- notahacker 7y agoiframes aren't deprecated. I'm only half joking...
- mrweasel 7y agoServer Side Includes are still exists. It is in many ways surprising to me that SSI never for more usage that it has, it solves a lot of small scale problem, for minor websites.
- ricardo81 7y agomrweasel indeed, exactly what I was thinking. SSI for the head, top, nav, bottom... unique content included. Update to the template is one simple edit. Taking it a step further with the likes of nginx, cache the response, compress it. done.
- DrScientist 7y agoWhat's missing from HTML is simple client side includes. It's mind boggling that it doesn't exist. XML has it - I can resuse the same image with a tag, but not HTML?? Why can't we have the same logic of SSI implemented in the browser? Probably the perfect being the enemy of the good again. This experiment by Jake Archibald looks interesting in this area. https://github.com/jakearchibald/streaming-include https://github.com/jakearchibald/streaming-include
- petercooper 7y agoHere's another approach: https://www.filamentgroup.com/lab/html-includes/ https://www.filamentgroup.com/lab/html-includes/ <iframe src="/images/includespost/htmlexample.html" onload="this.before((this.contentDocument.body||this.contentDocument).children[0]);this.remove()"></iframe> Given that Googlebot will render and use JavaScript now, I'd be intrigued as to whether this works with it, but client side it seems OK.
- DrScientist 7y agohttps://github.com/jakearchibald/streaming-include/blob/master/research.md https://github.com/jakearchibald/streaming-include/blob/mast... Also lists alternatives - see how whatwg request is bogged down in what/if complexity.