Metablogging: How This Blog Works

This blog used to run on WordPress, but I was not entirely happy with it. I changed it to use Octopress (an extension of Jekyll) and I enjoy the writing workflow better now.

WordPress is a content management system, and as such, it does a whole lot of stuff. WordPress has a ton of built-in functionality and is well-tested. With plugins, you can add many things: from shopping carts to calendars to image slide shows. Other plugins can give you detailed permission models and auditing for posting or other complex functionality.

Advantages

I didn’t like WordPress for blogging for a few reasons (many of them very specific to my workflow.)

I prefer writing with Vim, and no WordPress functionality was going to easily replace this tool. This alone would probably be enough to get me to switch. Typically what I would do would be to compose a post in Vim, and then copy that into WordPress, do a little previewing to make sure everything looked good, then schedule the post for some future date.

Using a static site generator like Octopress or Jekyll enables me to use git. Git tracks detailed version changes across the entire blog (not just the posts). It also lets me work locally and then easily deploy when I am back online or finished. With WordPress I would have to connect to the server to be able to write. I can now even preview locally, something I could never do without an internet connection. Further, I can set it up so that preview updating happens whenever I save the file, so I can see how changes look in near-real time.

There are Markdown plugins for WordPress, but I found them inferior to local writing with Vim (no syntax highlighting, generally quirky behavior.)

As previously mentioned, WordPress has a great deal of complexity, and most of that I don’t need. This translates to being more difficult to maintain, slower load times, and increased server requirements. Generally most posts would load within a few seconds, but by hosting the blog on S3, this is down to tenths of a second. I think Google rewards sites whose pages load with extra link juice, so this is an extra bonus for doing the right thing (making your site load faster.) WordPress has caching plugins, but I found these to be flaky and sometimes display old content. I prefer having things be easier to debug and more deterministic by just showing what I have deployed.

WordPress is prone to security vulnerabilities. Unpatched sites are open to known security holes, and even sites running on the latest version are one exploit away from being turned into a rogue spam blog. With static sites, you know what content is up there and there are no ways to easily change it.

I am much more familiar with Ruby than I am with PHP. WordPress is built on PHP, and Octopress/Jekyll are built using Ruby. That fact means that if I need to extend the blog setup, I can more easily do that with one of the Ruby-based generators.

Although not much in either case, the cost of hosting a site on S3 versus a shared or dedicated server is much less.

Setting everything up

It took me a while to get set up, mostly because I already had an existing WordPress site with a few dozen posts.

Putting comments into Disqus

This is the zeroth step in the process. If you have comments on your existing blog, transition them to use Disqus instead. This is an easy way to port comments between the blogs. I don’t have good links since it has been at least a year since I did this, but the Disqus documentation is pretty helpful.

Getting up and running with Octopress

The first thing to do is to install Octopress.

Next, you want to import your existing WordPress posts. If you only have a post or two you might consider just manually copying them or abandoning the posts. Otherwise I recommend using a combination of WordPress export and exitwp.

I needed to ensure things looked correct when transitioned from HTML to Markdown, which took a bit of time.

Next, I took an Octopress theme that someone else made and copied it locally and made some modifications. I found this much easier than typical theme development on WordPress since it was clearer what the CSS referenced.

Merging down my ‘debugging’ blog

I used to have a 'debugging’ blog that was for development thoughts and Stack Overflow-esque error statements that was at http://www.panozzaj.com/debug while my normal blog was at http://www.panozzaj.com/blog. These were maintained as two WordPress blogs, but getting Octopress/Jekyll to compile these together was tough. I ended up using a hacky Octopress issue suggestion for awhile to have the two blogs separate. This required me to have the debugging blog generate to a subfolder of the main blog, and then to add that output to the main blog’s git repository, and then to redeploy it whenever I wanted to see changes or to publish.

This was very unsatisfactory. I ended up freezing the debugging blog and writing a little extension to take the old posts and put them in the right place, and will just continue working on the main blog in the future.

Fixing comments

It is important to make sure that your blog URLs are in the same place as they used to be so any external links point to the right place. Again, this took a lot of time that a normal fresh install might not have taken since I had two blogs going to the same domain. Octopress by default only uses one Disqus URL, so I had to tell my old 'debugging’ blog posts to use a different URL to point to the correct blog. Disqus does not have a way to merge two sites (I asked.)

Publishing

I used a script that Wes Winham made that pushes static assets to S3 and modified it slightly. Publishing to S3 is now a one-command process.

Drafts

The only thing I was missing was drafts and post scheduling. I rolled a draft system using Chronic. Workflow:

 $ rake "new_draft[How This Blog Works]"
  mkdir -p _drafts
  Creating new draft: _drafts/how-this-blog-works.markdown
 # write.. preview..
 $ ./bin/schedule_post _drafts/how-this-blog-works.markdown "Tomorrow at noon"
  Scheduled at: 2014-02-20 12:00:00 -0800
 $ git add -A
 $ git commit -m "Write metablogging post."
 $ git push

Then I have a local Jenkins install running a script hourly to fetch the private Github repo and see if any posts needed to be published and, if so, publish them and email me. This has worked extremely well so far.

Issues

I had some issues early on with RSS flooding existing subscribers with posts every time I pushed or published. I ended up just putting one post in the RSS feed and having the time not be put in there based on when the site was generated, but instead when the post itself was published.

In retrospect, I think going with plain Jekyll and customizing it may have been a better choice in the long run. I think that since Octopress may be updated less frequently or abandoned as time goes on. However, for this time it works just fine and a lot of the work of transitioning from WordPress is already finished so it would be easier to switch to another platform. I have the wedding website as another static site just using Jekyll, and that worked out well.

Your turn

What do you use for blogging? Do you like it?

What things did I mention here that need more explanation? What would you like open sourced?

Categories: main

« Compelling Reasons To Fly Southwest Increase Homebrewed Jenkins Memory »

Comments