Tempo, a PHP static site generator
I got tired of the constant Tumblr outages and keeping a Django site up and running seemed like too much work, so I made Tempo. Tempo is a small static site generator written in PHP. I use it for this site and will probably use it for some others in the future. It takes
- A small PHP config file
- Text files with a simple header
- Source images of any size
- PHP-based templates
and transforms them into a static html site. It can
- Resize images to fit the specified page width
- Create a blog archive listing page and an Atom feed
- Skip "draft" posts (filenames that start with #)
- ...not much else, really. Isn't that enough?
URLs are built like this:
about.txt becomes about.html
blog-2011-10-10-blog post title.txt becomes blog/2011/10/10/blog-post-title.html etc.
For text formatting, just use HTML tags. URLs starting with http:// are automatically converted into links but if you add your own <a href tags, it will try not to mess them up. The script could be extended to accept Markdown, I just didn't think it was necessary for me. To see how you can insert resized images, check out the example site below.
UPDATE 12/2011 - now on GitHub
You can download an example site here: tempo-catnap.zip
Unzip the example site, edit generate.sh to point to the tempo.php script from GitHub and run it. The generated output should appear in the www.catnapgames.com/output folder. upload.sh is an rsync upload script included to give you an idea how to update the site on a live server; obviously you don't have the ssh keys so it won't work.