Something's new in the air

Posted on May, 25 2014

After a week of work, I finally moved away from my weird blogging platform written in a weird language.

When I started this little project to make a website of my own, I was dabbling in the art of "PHP". This was a very dangerous, and a rather scary art. My little website needed a way to dynamically manage content, for it would be a Blog in which I would write posts of text and share it with the internet. It so happens that I started delving into PHP to do such a task.

A few hours later of thinking about how I would do such a thing and bam, I came up with a way to have a small text database in JSON to assemble a page with various posts based of a series of templates and some fancy text manipulation skills. At the time, the simplicity astounded me. The architecture went something like this: index.php, posts.json and pagedata.json all in a directory, index.php reads pagedata.json and constructs a template and evaluates any sort of queries, and then takes data from posts.json and assembles the proper page for a specific request. For any other page, you would just configure pagedata.json to get the proper output.

At the time, this was on-par with what I required. As time progressed, I slowly began to realize that maybe this wasn't a best idea.

For example, as the posts accumulated I noted that the size of posts.json and how inefficient it is to load that big of a file every time someone loads the page. The idea then struck me to create a static website builder.

The concept is simple: Take a configuration and various templates to create the entire site into html files, and serve them instead of evaluating scripts. For large sites with content create by users that require accounts, this is not possible. But for a simple blog that should be static in the first place, it is the best option.

When it came to actually creating the first iteration of the program, things were slow and steady. To transition from a script that created all the pages from just spitting out a string on the request of a page, to something that interpreted and built the entire website with one command was something that required some thinking. The concept for the program was to take a generic configuration specifying the page name, page variables, templates, and modules for a given page. The program then would go through each page and generate a template and run a specified module to create a set of subpages. Once all the pages were done being processed, the site with all the pages and subpages would be written to a directory. With the new content managing system, there is no more limitations to what pages can look like and behave.