Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It isn't well known though. A lot of people know of server side includes but don't know how to write them. I'd fail that interview question.


Fortunately, nginx's server-side includes are (or at least appear to be, on a production website) quick, robust and very easy to learn.

I was facing exactly this problem on a static HTML website a few months ago, and was pleased to discover that two Google queries and five minutes' work left me with a functioning SSI.


That misses the point of this article though, it isn't about easy to learn tools, it's about not having to learn something at all.

I've used SSI and I don't wish to use it again. It isn't the same as a static page, and is too underpowered for me to want to use it for a dynamic page.

It reminds me of files that don't contain a well-formed html fragment. Stuff like

    <!--#include "header.html"-->
         <p>Hello</p>
      </body>
    </html>
Oops, did I just remember the proper syntax for SSI? Guess I might not have forgotten it like I intended to. :P

Also server side includes are using a second language inside a first language without any introduction to the second language. No mention of them here: http://www.w3.org/TR/html401/

Edit: I didn't quite remember it right. It's <!--#include virtual="header.html"-->


Server side includes amount to a preprocessor, no? A lot of code is written that way without major incident.


The trouble is that the preprocessor isn't referenced anywhere, and it's going to confuse many web developers.

It isn't in the file extension, the extension is just .html.

"include" by itself is the tenth result on google. "include virtual" and "include file" (without quotes) have SSI in the top results. But not everyone is going to google that.

With C most knows there's a preprocessor. That could be true with HTML and Server Side Includes, but it isn't.


You're wrong, the extension by default is unique, shtml. You can order your webserver to parse all HTML files as SSI but it's not recommended.

Searching for server side includes on google works fine.

And the comment-formatted "#include" directive seems pretty clear to me.


That's right, files might be named shtml. Hadn't thought about that. But if the file isn't an index, that detail makes it to the client side, confusing users, doesn't it?

The phrase "server side includes" doesn't appear anywhere in the "#include" directive. I'm talking about what could be gleaned from the code alone. And again, if they put file or virtual in their search term, they get the result. I just don't expect all web developers to do that.

To address your last point: the #include language seems simple but it doesn't explain why it's happening. It would seem like black magic to someone who thought their host was just sending files to the client and didn't know about SSI.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: