phdru.name / about

About making the site

The site was, is and always will be maintained and hosted using only free software. Current winners are: Linux and FreeBSD operating systems, web-server Apache, vim editor, Python programming language, CheetahTemplate.

The site is static. I thought about making it using wiki or blog software, but decided not to go that way. I mostly don't like those "personal journal" sites, I don't like to publish small notes every few days. I prefer to put text infrequently and I prefer to choose the format for an every file separately, depending on the file. Also there is a number of mirrors of the site, and those mirrors are static. So I decided to make it completely static.

Initially, when I started to create the site back in 1994, I edited every file by hands - just copied a template that included all HTML blurb and filled it with content. Later I decided to really use templates to generate HTML files - so I need only to provide contents, and templates will do the rest. In the middle of 2004 I started to experiment with different template systems and scripts to generate the site.

My first attempt was to use ht2html, a program which is used to generate Python and related sites. The attempt was partially successful - I converted all static HTML files to templates, and wrote a number of scripts to generate the site. Also I wrote a code that converted text files to HTML, making URLs real links (hrefs), similar to what wikies do. The failure was that ht2html required patching to suite my needs, and those patches were not accepted by the authors (well, I must admit they were no rejected either). It is understandable - they are Python core developers, and are very busy with their jobs. But I didn't want to rely upon a program that I constantly need to patch.

So in the beginning of 2005 I decided to find an alternative. I looked here and there and finally came to CheetahTemplate. I've already thought about using CheetahTemplate for other projects, so I decided to give it a try.

Converting ht2html templates to Cheetah was not a big task. A simple script did it in a minute. Then I developed a framework to generate the site. The framework is rather simple. The CheetahTemplate compiles templates to Python modules and classes, so the language in a template is as powerful as Python itself - not only there are loops and conditional clauses, but also inheritance! I created a Python class phd.py, that serves as the base class for all my templates. The class contains base code that I prefer to write in pure Python. In particular, there is the code preserved from previous version of the site that converts text to HTML.

All modules and scripts here are free - you can do whatever you want, just don't blame me.

Then there is phd_site.tmpl, a template that inherits phd class, initializes a lot of common variables (title, description, and so on) to default values (usually None). Any particular template on the site being a descendant of phd_site.tmpl, can redefine these values. The base template includes all necessary HTML, so any descendant should only provide a title and a body in text or HTML format.

And finally there are a number of scripts to do the real work. make-files checks if phd_site.tmpl needs to be compiled (does phd_site.py exist? is it newer than template?), compiles it, and fills all templates listed on the command line.

make-changed lists all *.tmpl files on the site. The companion program make-changed.py scans the list, compares template and HTML modification times, filters those that do not require updating and lists modified templates. Then make-changed runs make-files over the list of modified templates. Just so simple, really!

The site is generated using these scripts on my home computer and synchronized with phdru.name and mirrors using rsync. All files are available in a git repository:
git clone https://git.phdru.name/phdru.name.git
git clone git://git.phdru.name/phdru.name.git


This is the page https://phdru.name/about/technical.html. It was generated on Sun, 16 Jun 2024 10:04:53 GMT from CheetahTemplate technical.tmpl. Some rights are reserved. Read more about technical aspects of the site.