About Books Credits Photos Software Rumblings Travelling Home
Static vs. dynamic generation

I’ve been debating with myself the concepts of static site and dynamic site generation ever since I read “Creating Free Software Magazine” in issue 0 of the Free Software Magazine.

Let me first define what I mean by static and dynamic generation for a website:

Dynamic generation is the on-demand generation of content. You usually need LAMP or equivalent to do anything meaningful.

Static generation means that the site is comprised entirely of static HTML pages that have been pre-generated from various sources before publishing the site.

pros

Quickly quoting from the article, a statically generated site:

I’d like to add that a statically generated site is also a lot easier to test/view before publishing. You don’t even need a webserver locally, you just open the files in the browser.

I also find it more natural to edit an XML file with an article than to fill in a form that will store it in the database. Correcting spelling mistakes and generally editing is just not done on a database table, you need to invent a whole system for it. Granted whole systems exist, but then I have to install and configure them which takes almost as much time.

It’s also infinitely more easy to throw the whole site design away and replace it. Just delete the site folder and replace it with the new and hopefully improved generated site.

Hosting is easier too: You don’t need an ISP that provides all the snick-snack needed to setup a dynamic site. Just ftp access and storage space in a limited account will do.

Last but most important in my case, hacking a few scripts to statically generate a site can be done in a very short time (the actual working prototype took me about 4 hours), giving you the satisfaction of having a “custom solution”.

contras

On the downside you can’t have a proper blog without commentary and nowadays it should be running commentary (more because it spares you the spam by not forcing you to publish your email address than anything else). This kind of comment/rate/post system cannot be done with static generation.

One could keep the whole static generation structure though and use a template to embed code in the HTML article pages effectively isolating the commentary/forum part of the site from it’s main content. This is a venture in dynamic site generation I might consider in the future.

Posting on-demand from everywhere is also difficult to achieve, since static generation assumes an off-line repository of content/forms/templates and generation scripts. This is something I solve with my laptop :).

I trade the ability to keep everything under version control and on my own computer (reserving time for review) with the ability to post an article from any internet cafe in the world. It’s a personal choice, just like religiously downloading all emails on disk. Working offline is as much a privilege as working online.

Technically you need to republish the whole site every time you change something (even if you haven’t touched the templates).