This week, I resolved to code. I hadn’t done anything serious for a while and I decided that the right time had come. So I sat down, wondering what to do. I started surfing the Internet. I ended up reading an article comparing web frameworks and CMSes (I had recently been exploring Drupal and WordPress). An idea slowly spawned about making my own CMS type software. Something simple, like a proof-of-concept.

What I ended up making was a Python script capable of taking a directory full of posts, with content in text files, and laying out a page depending on the desired template. After writing what looked like a very specific case, I paused and realized that I could abstract this. Soon, I refactored it to make more extensible.

Then, came along an object with template functions to handle each component of the web page separately. I had been using a text file with a list of posts with each post to be included on a new line. This became inconvenient when I wished to handle metadata. Soon, this list became a JSON file which would be easier to access and modify than a database but would add scope for easy-to-edit metadata. Using Python’s JSON module, I eliminated storing any post info in separate run-time variables and just dumped (literally) the whole JSON into a dictionary.

Here is where I took a break. I still haven’t resumed work on it, but I’m toying with the idea of adding a plugin-manager and handling images more elegantly (actually, showing images at all, without the user having to code markup, I haven’t started handling images yet :P).

Right now, it’s a script that you have to call, that generates static pages. Soon, I’d want to convert it into a server, so that the posts are served real-time. I don’t want to have to re-run the script every time I edit post or create a new one, somewhat like a smart build tool. The page template functions should be part of the HTTP response probably a GET query.

The header image is a screenshot of it – taken immediately after a fresh run of the generator script. I am hoping open-source it on my GitHub soon.

The original goal was to make a lightweight web publishing tool, so that anyone who wanted to publish their writings, would just need to write a few text files. The styling is done separately with CSS – the generator has classes assigned to important sections. Including stylesheets in the package so the publishing process becomes instantaneous would be a good idea. I should seriously consider adding a media-library. Oh wait! How about a GUI front-end to edit the metadata.

Ideally, there would be an online marketplace where content writers could find stylesheets (free as well as paid) that they can easily integrate into their site.

It would work pretty well as part of a web server. All users would have to do would be to enter information about each post in the (proposed) GUI tool, and have their content ready. I feel like getting my hands dirty again.

See you soon!