My blog has been hosted on Posterous for quite some time. I decided to move it when Twitter bought Posterous. I finally have. I thought it worth documenting my reasoning and motivations for future reference.

Why move from Posterous?

The acquihire by Twitter meant, should twitter chatter be believed, that further work on Posterous was pretty much cancelled. The team were ‘excited to be working on Twitter’, rather than ‘excited about making Posterous even better as part of the Twitter empire’. Bye bye Posterous.

Painful escape

Moving your blog away from Posterous is pretty painful. Posterous doesn’t offer ANY export options. So the accepted mechanism is to write something yourself using their API, use the pretty decent WordPress importer, or use a paid service like export my posts.

I chose the WP route. A quick install of WP, run the Posterous importer, then run the exporter. I now have a nice directory of assets and a big wp.xml file. If I was planning to host on WordPress I had now moved – apart from some minor nasties with formatting, and file paths.

There is one more step to getting your code into Statamic – see below.

Why not WordPress?

Some of the content on my Posterous had been imported from a previous WP blog. I moved from WordPress for a few reasons. I grew frustrated by the knitting in boxing gloves feeling you get working with WP themes. The updates were a pain with the way I had my hosting setup. And Posterous was ‘the new hotness’. Who could resist.

I had some pretty specific requirements on my wish list:

  • ExpressionEngine level template / channel flexibility
  • Deploy through git
  • Content in files
  • Portability
  • Lamp

No DB wasn’t on the list, but demanding content to be in file format pretty much dictated this. Open source wasn’t on the list either. As long as I have my content in files, including assets and meta data, I can port them to a new system. It’s half of the fun.

This was the main driver in moving, and the over-riding reason I didn’t opt for ExpressionEngine, a system I know pretty much inside out by now. Ownership over the content, postability, and the control over all aspects of the site were absolute requirements.

Statamic

Statamic

There are quite a few options on a Ruby stack that satisfy my needs – but on Lamp things are pretty restricted. Statamic is a great fit for me though. It has a control panel that I don’t really use, but other than that everything is driven from the content files.

Here is an example of a VERY simple content file:

---
listing_image:
title: Move to statamic
categories:
  - code
  - stream

featured: no
author: Admin
 
---

##title

This is a tweet length blog post. Adorable. 

As you can see, categories are set up right there. If that was the first use of the category ‘example’ it will add it to the navigation. No ‘categories’ section to set up. Just fire it in there. The post body can mix markdown and html – so my old posts from Posterous are all still stored as HTML. I can change that if I want – but for now it works just fine.

Templates

Templates use a combination of layouts, templates and partials to pull together your pages. The syntax is simple:

{ { entries:listing folder=”blog” limit=”10” } }

 <div class="entry">
  { { if no_results } }
    <h3>{ { no_results_text } }</h3>
  { { else } }
    <h2><a href="{ { url } }">{ { title } }</a></h2>
    { { content } }     
    <div class="entry-meta">Posted on <span class="date"> { { datestamp format="F jS, Y" } }</span></div>
  { { endif } }
  </div>
{ { /entries:listing } }

Routing is based on the content filenames. Everything just works as you would expect, and you have flexibility to split content into channels, streams etc… easily.

Statamic import

There isn’t an ‘import’ as such, but the PHP file in this gist does a great job of tearing that wordpress.xml file into individual markdown files with a basic meta header. It missed a few meta things for me, but nothing I didn’t want to re-address in any case. Your mileage may vary.

Backup and Deployments

This is the best bit. With Posterous if the service disappeared then so did my blog. Nae luck.

Now I deploy through git to my server, so I have full change history for rolling back changes, checking when I updated stuff, and can switch branches to try out new themes etc…

I also keep my local copy running on MAMP for a local fully working copy of the site. I also keep it in dropbox, so it’s on a bunch of machines at any one time.

So I now have a small directory with a bunch of text files which I can punt around as I see fit. If Statamic goes evil, and I’ve no reason to believe that it will, I can write a wee script to tear through those text files and reformat my meta data to suit another engine pretty quickly.

Next

So I’m pretty happy with the new setup. I really haven’t found anything that Statamic doesn’t let me do. I’ll update this if I do. It only took a couple of evenings to get this far – half of that was building a theme and learning the principles. A lot of the rest of the time was just hand tidying the exported files.

It’s worth mentioning that Statamic is paid software. As this is a personal site I get away with the $19 licence.

The next job is to get my other ‘stuff’ into this repo. So when I tweet / app.net / instagram etc… I either originate it here and syndicate out, or syndicate it back into here to keep an archive copy that I own.

Wish me luck…