For a basic CMS that does not require dynamic functionality like comments, why not write static .html files to disk? Then a high-performance, static file, web server like nginx could be used to serve the files. This would theoretically deliver the highest performance web site possible.

EDIT: "Basic CMS", in my mind, is something a company could use for their corporate site. The content needs to change my a marketing person, but there typically is no dynamic content like comments.


That would be OK if none of the content ever changed. As soon as something changes you need to regenerate the html. Even if you don't have comments, presumably you are using a CMS because your content has the potential to change.

A CMS would have a cache, but it still needs to check to see if any of the content had changed since the last time the html was generated. The cache also takes up disk space - while not a big issue, it is a consideration.

So depending on the frequency with which the content changes and how much content there is, it might not make sense to pregenerate the html.

If you are serving .html files, do you need a cache? What would the cache do?
Christopher Altman
@Christopher - I was assuming that the CMS didn't store it's data in HTML format, but needed to generate it.

When you say static content, most CMSs assume its content that needs to be fixed, but needs to be editable. I believe that's the reason why they're never written to html and saved to a database instead.


Most CMS probably need some dynamic features.

But there's a few, specially blog engines, that work the way you described. It's a set of scrips that generate a blog, including atom feeds.

Take a look at utterson for example:

Vitor Py

Though this is not a direct answer to your question, I remembered some blog post I recently read about this, which might be of interest to you: baking vs. cooking.

It describes the conversion of a WordPress blog into a "baked" solution.


One reason would be that a say, SQL, solution allows for you to separate your layout and template concerns from the data itself. Your content is therefore agnostic to changes in structure, which makes things easier to manage. With a file-based approach, any change to your structure would require you to delete and re-write all existing content.


Because most CMSes require dynamic functionality of some description (or at least have it as a feature, and therefore design their architecture around that need).

Also, most CMSes are not "basic" - they're highly complex "jack-of-all-trades" webapps that often do far more than you want/need - most of it dynamic.

Many CMSes do cache as you've described though, and most of the ones that don't have some kind of module/plugin/etc. that does so. Drupal for example has Boost:

+1  A: 

One reason is that even basic sites make extensive use of 'dynamic' content. Consider a sidebar of the most recent articles - if the site was static HTML pages, every single page of the site might have to be rewritten every time a new post was published.