Alternative Title: Why Does PHP Still Exist (I promise, this isn't a PHP complaint article.)
Shortly before making Icy Blog, I took a good look at Glaciate. It was stagnant with little (if any) content and half of the systems that I had painstakingly wrote were broken during a web host transfer. I wasn't ever really happy about nothing happening.
I thought hard about what I wanted it to be. Or rather, what I wanted to use to get it to be what I wanted it to be. My requirements were simple:
- It had to be something I could actually understand to make changes to. This ruled out anything PHP-based, as frankly, I don't want to think of a single hilarity that goes on with that thing.
- It had to be something I could easily style. As much as I love WordPress, too much trial-and-error goes on for my liking. This is more of a me issue than a WordPress issue.
- It had to be something I could easily publish to. I don't like having account systems for things that only I can have access to. Many blog systems are more complex than my needs. I can easily make a new post by just creating a new text file, commiting it to git and pushing the change to heroku.
If I had to look back, I would say to reverse the order of how I "learned" the language.
Maybe I would have reached this conclusion sooner.
It's easy to actually get something great done, and in reasonable time.
Perhaps the best change for me is that it's created an opportunity for me to just raze my old content to the ground: I can start fresh and pay some small amount for the site to run on a heroku dyno. It's time for the stagnation to end!
Now, I had no intention of reinventing the wheel (even though I've seemingly done exactly that), so my aim was to spend no more than 2 hours on programming. The very first thing I did was write out a sample blog post in the format I wanted to write it. Part of the solution was simple: use Markdown.
I love Markdown! It's incredibly simple and I could just write in a text editor with no need for any additional buttons or features. Just the page and me. I also needed some place to put metadata associated with the blog post, and it had to be something I could add to at any time with no hassle.
/content/blogs/ directory, I simply save each text file like this, and append it with
.md. On start up, they will be parsed, sorted be creation order and that makes the blog!
With each push to heroku, the dyno restarts and the blog is rebuilt. Probably not the best of methods, but simple and effective enough to not need to involve a database.
Next came actually writing somthing to parse it, which was...also pretty simple. I used a packaged called marked which lets me fling a string of Markdown at it and it spits out compiled HTML.
Finally, to actually serve it, express made light work of it, complete with proper routing for pages and each individual blog post.
Not bad for 2 hours of work, huh? I think I spent more time tweaking the style than actually programming.
Later on (read: when I feel compelled to), I'll add the remaining planned features (tagging, feeds, custom pages and authoring)!