Zhar.net Site Generator

Zhar.net template system

zgen v0.5

  1. README - brief docs, changelog, etc.
  2. process.py - you exec this one.
  3. options.py - option processing.
  4. PageTemplate.py - class defs.
  5. layout.tmpl - my top level Cheetah template.
  6. zhar-template.tar.gz - a tarball of the directories/templates used to generate this site (sans images and other big files). Provided as an example.

My previous site was hosted in Zope but for my new site I wanted to simplify and eliminate overhead with a static site. While that sounded nice, I had gotten accustomed to having a template system for site design. So I went shopping for a template system I could use to generate a static site. I wasn't able to find anything I really like so I decided to roll my own.

It is a pretty simple system written in Python consisting of just a few files. It uses Cheetah for its basic template rendering and a simple heirarchical directory layout for organization. At this point it would be mostly of use to people already familiar with Python or willing to get that way. It is pretty flexible, but requires python for any significant change from its default setup.

The basic structure is to have a top level Cheetah template that is used for every page. The layout is a directory based heirarchy with one page per directory. The main template has a hook to pull in the body of the page. Each an every bit of content is rendered as its own template, so you can build up the pages from parts and pull in content from other areas. Other features include a sitemap, modification tracking to speed up processing, command line option parsing with config file support, plus a few other things. The code is commented a bit, but I wrote it primarily for my own use and thus documentation is lacking. If you think it might be useful to you but have some questions please drop me a line and I'll do all I can to help.