Fotolia_55771234_XS.jpg

But Why?!

Most simply, WordPress just wasn’t the tool for what I needed.

My Requirements

  • Write locally, then push to the server
  • Markdown or Textile
  • Easy backup strategy
  • Performant
  • Maintain existing comments

Write locally, then push to the server

Writing locally means I don’t have to worry about sessions, exposing an admin section of my site that could be compromised, etc. Additionally, it means I can use Git and put my blog under source control.

Markdown or Textile

Self explanatory

Easy backup strategy

With WordPress an export gives you the content, but you also need to make sure you have a backup strategy for your database, images, etc.

Putting my blog in Git with a static generator means my source is my backup. Should someone ever hack my site, I just change my password and push again.

Performant

Self explanatory. You can’t get any faster than statically generated pages, even with WordPress cache plugins (which surprised me, they still seemed slow).

Maintain existing comments

Luckily my comments are already hosted via Disqus, so I simply needed to make sure whatever my solution would be could reference my existing post comments.

The Solution

Hexo! To get started, I just exported my site out of WordPress and imported into Hexo with hexo-migrator-wordpress.

Then, I downloaded all of my WordPress images and placed them into the posts’ asset folders. To use them, change the image references to {% asset_img image_name.png %}

Additionally, my previous code blocks were pretty messed up, so I replaced them with:
{% codeblock FILENAME lang:LANGUAGE %} ... {% endcodeblock %}

Next, I had issues with my image links. Where I wanted to do something like this:

1
{% asset_link full-image.png {% asset_img small-image.png %} %}

Instead I had to use traditional markdown, like this:
1
[![Title](full/path/to/small-image.png)](full/path/to/large-image.png)

The theme I went with (Tranquilpeak) supports both Google Analytics and Disqus, so I simply updated the _config.yml, then in each of my existing posts I added a disqusIdentifier frontmatter that matched my old posts.

And with all of that, here we are! Luckily without too many posts already it wasn’t too much work.