New Blog... Again.

Posted on
Tagged in ghost , bolt-cms , blog

Huh?

I decided, once again, to get a new blog system for my site. My last attempt was using Bolt CMS. While I did enjoy the ability of adding and maintaining pages and content types, I still found the WYSIWYG content editor to be overly cumbersome. More often than not, I'd find myself switching over to the HTML mode to put in manual changes. Minutes later, back in WYSIWYG mode, I would realize that it overwrote my HTML changes.

Bolt WYSIWYG Editor

I really wanted something which I could enjoy writing on, and Bolt CMS was proving to be a hinderance. It's understandable - I mean, Bolt is not a blog platform, but a content management system. It has to be flexible. I thought I could deal with using it.

The Old Site

Most of the problems with Bolt, I brushed off. It was still a decent, secure, and flexible system. I was able to make pages which sub-pages, and the templating system (Twig, a PHP templating system) was fun to use.

Then, two things happened. The first: a problem after uploading my site to production. The second: attempting to extend core functionality.

Problem 1 - The Source Code

Some background information: I developed on Windows 8.1, and deployed on Ubuntu 12.04. The deployment was on a DigitalOcean Ubuntu droplet, of which I configured Apache/PHP/MySQL myself. After verifying the site worked correctly locally, I uploaded it and called it good.

A couple days later, A friend pointed out to me that a couple of pages on my site weren't rendering properly. When including the themes, I noticed that it was including the "index.php", which is the "front controller" of the blog. In your browser, what you see is http://www.brendan-bates.com/page/about-me. The Web Server, Apache 2.4, then rewrites this to the URL of the front controller to http://www.brendan-bates.com/index.php/page/about-me. When generating links to all other website pages, the "index.php" portion should be omitted. This is especially the case when pointing to static resources like images. This is because the front controller will not know how to find a static resource. For example, if the site was trying to load the site-theme.css file, it would look for http://www.brendan-bates.com/index.php/css/site-theme.css. Since the index.php front controller does not know how to fetch the CSS file, it would throw a 404 error.

I had to delve into the source code to fix this. I discovered that a lot of the core functionality exists in a "lib.php" which is over 1500 lines long, containing only imperative code with little organization. I had to add a few lines to the function getPaths in the app\classes\lib.php file:

// Check the path prefix for presence of '/index.php'.
if(strpos($path_prefix, '/index.php') !== FALSE) {
    $path_prefix = str_replace('/index.php', '', $path_prefix);
}

What causes this bug in production, not development? I have no idea. I plan on looking into it as an official bug fix (if necessary) at some point. But it was a quick fix, and it worked.

Open Source products are susceptible to bugs, I understand that. This one seems to be more of an "edge case", where my specific configuration was causing issues as well.

Problem 2 - Extensibility

A couple days after the site issue was fixed, I tackled my next blog project: adding an automated "about-me" page. I thought it would be cool to write an extension that would allow every user in the Bolt system to have a page devoted to them. Unfortunately, I found that the Bolt core is only lightly extensibile. You can't access a lot of the internals without source-code hacking, and that makes future updates nightmarish.

I do believe this is a problem that will be solved eventually, however. They plan on opening up their API more in the future.

The New Site

Right now, to me, writing actual blog content is more important than digging down into blog source code and modding. So, I decided to stray away from complicated CMS packages and use the new Ghost blogging platform. I have found that it is:

  • Simple.
  • Lightweight.
  • Easy to theme.
  • Easy to blog.

As far as posting, it uses Markdown, which is an extremely easy to use markup format. The user interface is incredibly simple, and it makes writing very fluid. I am sacrificing the flexibility of making individual pages and content types. Right now, what I need my site for most however is writing content. And Ghost fits the bill great.

The simple user interface

I'll be migrating my old posts over here soon, so be sure to come back soon to check them out.

comments powered by Disqus