News for hackers. Stuff that matters.
Re:HTML is all you need to make a website by rchaud on Thursday November 17, 2022 @03:00PM (#33644761)
Is there an HTML-only way of separating menus from the html page? Similar to how external style sheets only need to be edited once to apply on all pages where it's linked?

Of course we all know something like:

<?php include 'menu.php' ?>

But in order to get that working, the site can no longer be HTML-only, it will need a web server and pages must be titled .php. This assumes most people are building multi-page sites, and not those one-page "link in bio" style pages.

Re:HTML is all you need to make a website by uberman on Thursday November 17, 2022 @03:09PM (#33644906)
You might check out "server side includes" if your web server supports them.

Here is some apache documentation: https://httpd.apache.org/docs/current/mod/mod_include.html

Re:HTML is all you need to make a website by rchaud on Thursday November 17, 2022 @04:45PM (#33646266)
This is what I was doing in 2015 when my brain was fried with HTML and CSS and I was desperate to avoid having to learn even more syntax (PHP). I remember trying something like .shtml and .dhtml.

It didn't feel "real". I had never seen web pages with those extensions. Frankly, I hadn't even seen .html pages in several years because everybody edits the .htaccess file to prettify the URLs.

I ended up biting the bullet and going with PHP. Surprised to learn that there still isn't anything out of the box that handles this.

Re:HTML is all you need to make a website by deafpolygon on Friday November 18, 2022 @02:41AM (#33651564)
That still requires a server.
Re:HTML is all you need to make a website by uberman on Friday November 18, 2022 @09:00AM (#33654775)
True. Though How would one serve a website without a server in some capacity?

SSI like those from apache acting in otherwise the most privative form of server just using paths and no routing produce the kind of repetitive HLML that iframes via the client produce.

Re:HTML is all you need to make a website by Phrodo_00 on Saturday November 19, 2022 @02:29PM (#33673708)
... Serving HTML requires a server?
Re:HTML is all you need to make a website by pjc50 on Thursday November 17, 2022 @03:11PM (#33644929)
There used to be Apache server-side includes for this. It is kind of an odd omission from HTML that you can't insert a bit of DOM from a different source without Javascript.
Re:HTML is all you need to make a website by martinskou on Thursday November 17, 2022 @03:35PM (#33645271)
If only <frame> was'nt depricated. /s
Re:HTML is all you need to make a website by giaour on Thursday November 17, 2022 @04:35PM (#33646111)
<iframe> isn't
Re:HTML is all you need to make a website by XCSme on Thursday November 17, 2022 @06:41PM (#33647616)
But isn't the performance of iframes a lot worse than simply adding a JS request?
Re:HTML is all you need to make a website by deafpolygon on Friday November 18, 2022 @02:42AM (#33651572)
No, not at all. It's just "worse" because often you load a whole page. If you load only a fragment, then it's just as fast as anything else.
Re:HTML is all you need to make a website by handzhiev on Thursday November 17, 2022 @03:09PM (#33644897)
There was a tech called SHTML. Still not HTML only, but pretty close.
Re:HTML is all you need to make a website by golergka on Thursday November 17, 2022 @03:02PM (#33644803)
Once upon a time, many years ago, web designers used iframes for this — however, this is not something I would recommend. But it is an html-only way.
Re:HTML is all you need to make a website by giaour on Thursday November 17, 2022 @04:36PM (#33646127)
<iframe> is about as close to a client-side include as you can get in standard HTML.
Re:HTML is all you need to make a website by tannhaeuser on Thursday November 17, 2022 @05:01PM (#33646478)
HTML the markup vocabulary itself doesn't have these, which makes sense when seeing HTML as an SGML application inheriting all what SGML had to offer for transclusion using entities, and quite powerful means for content-oriented applications such as using markdown (or other custom syntax), building tables of contents/site maps, search context snippet and other summary generation, type-checked user and third-party content inclusion, etc. See [1] to get a flavor for including a shared header/menu and footer on multiple pages.

[1]: http://sgmljs.net/docs/producing-html-tutorial/producing-htm...

Re:HTML is all you need to make a website by perilunar on Thursday November 17, 2022 @07:15PM (#33647933)
<iframe>, <object>, and <embed> all work. But you need to add target="_parent" or target="_top" to all links.

There really should be an <include> element. e.g. https://www.w3.org/TR/xinclude-11/

Re:HTML is all you need to make a website by ndriscoll on Thursday November 17, 2022 @07:52PM (#33648296)
Depending on how far you want to stretch the definition of "HTML", this can be done with XML pages that link to XSL stylesheets to describe common layouts.