Edit 16 Dec 2013: For a richer and supported solution, check Ruby-based Nanoc.

After checking out a bunch of Content Management System (CMS) softwares, either server- or desktop-based, I got fed up looking and wrote my own. I wanted the following features:

So... I finally wrote the following snippet in PowerBasic Python and the PyWin32 module Delphi 7 to display a basic GUI and generate a static web site. Things can be simplified yet by compiling the Python script into binaries using py2exe, and combining the few files that are created into a single file using PE Bundle Thanks to Delphi, this EXE has no dependencies, and requires no installer.

Here's how to set things up:

  1. At the root of where you want to store the files for the site on your workstation (eg. C:\WWW), copy this EXE
  2. In C:\WWW, create a directory called .\input. In this directory, create sub-directories, one for each category of articles (eg. .\input\Unix, .\input\Windows, etc.) The names are significant, as BabyCMS will use them in the index page. In other words, renaming a sub-directory changes the category name displayed in the index
  3. Populate those sub-directories with HTML files with the HTML editor of your choice. Word generates crappy HTML, but BabyCMS doesn't care as it will extract data stored in the TITLE, KEYWORDS, and BODY tags, and ignore the rest of the document
  4. In C:\WWW, create a directory named .\templates, and empty this ZIP file there. As you can see, those files are used to generate articles, including a header and a footer.

    At this point, the EXE should be in C:\WWW\, and you should have two directories, C:\WWW\INPUT\ with a least one subdirectory, and C:\WWW\TEMPLATES\ with a few HTML files
  5. Run the EXE: It will loop through the list of sub-directories in .\INPUT, merge each HTML file it finds with the templates, save the resulting article in C:\WWW\OUTPUT (which will be created the first time the EXE is run), and an index.html will finally be created in .\OUTPUT, listing all the articles, each layed out in the category where it belongs.

    To speed things up, a file named data.txt is created at the root of the site to record the TITLE and category to which each file belongs, to avoid needlessly opening all the files where rebuilding the index, even for files that didn't change since the last build
  6. Use your favorite FTP client to upload the contents of .\OUTPUT to your web server.
  1. Create a directory to host everything, such as C:\WWW
  2. At the root level of this directory, create a directory eg. /script/ and put babycms.py in there, after making sure you installed ActivePython (this distribution for Windows includes PyWin32)
  3. Still at the root of C:\WWW, create a subdirectory input/ (ie. C:\WWW\INPUT) where the raw articles will be located. "Raw" means the articles that hold the actual contents before we massage them to have a common look and feel
  4. While in C:\WWW\INPUT, put INDEX.TPL and TEMPLATE.TPL, which are the templates that will be used as the layout to generated the homepage and articles, respectively
  5. Personally, I keep the CSS and a couple of GIF at the root of the site, and images somewhere below /images/. If you change this, remember to update the template files accordingly
  6. Each article in input/ must have the following layout:

    <title>The article's title</title>
    <meta name="description" content="Some description">
    <meta name="keywords" content="some keywords">
    <meta name="classification" content="other">

    [the actual article here...]

    Important: As you can see in index.tpl, each article must be set to one of a few categories (unix, windows, other, japan, misc.) This is how BabyCMS can tell in which section an article must be listed in the homepage. To customize this stuff for your site, edit index.tpl according to whatever word you use in the Classification metatag in source HTML documents.
  7. Run BabyCMS: It will loop through each HTM(L) file in input/, create a cuter equivalent under C:\WWW\docs\, and (re)generate index.html at the root of the tree
  8. Use your favorite FTP client to upload /index.html, /docs/*.*, along with add-ons like a CSS file, and images.

Voilą! :-) You now have your very own fast, static, personal web site, without bothering with clumsy, browser-based, through-the-web editing.

Full disclosure: Since I have zero artistic talent, the look and feel of this site was shamelessly stolen from the default layout that comes with the database-free, PHP-written Pivot CMS.