Into the Woods with Statamic

October 12, 2012 4 min read

A post from @typaulhus on ADN was the first I heard of this “Statamic,” and after a brief period of skepticism I’m head-over-heals for it. Statamic has officially replaced ExpressionEngine as CMS of choice for this humble little site. Why is it so exciting?

  • No database. Fast, easy to deploy, and I can keep everything in Git without doing anything clever.
  • Content is stored in Markdown files. This is a huge plus because I write just about everything longer than a paragraph in Markdown and then I have to figure out how to get it into that other thing. I can skip that step.
  • Very clever design. It’s very clear that Jack and Mubashar wanted to get away from EE’s bloat while taking advantage of its templating convenience and … well … Structure. It feels perfectly focused as a CMS for small sites and blogs, while being flexible enough to work for web creators that have ideas beyond a WordPress theme.
  • Gorgeous admin panel. Blazing fast and perfect on an iPad? Yes and yes. If you think that’s shallow, log in to EE’s admin panel on your iPad. I’ll wait.

The migration from EE went smoothly and happened more or less in one evening. Here’s how I did it…

Step 1: move comments to Disqus.

I was using native EE comments, and the easiest path here was to create a Disqus account for the site and import my previous comments. Ryan Battles posted a template tutorial for exporting a WXR file for Disqus. It’s as easy as creating two templates with just a little bit of required consideration.

I foolishly waited quite a while and even opened a support ticket before finding import.disqus.com, which barfed on a syntax error in my XML. I waited another 24 hours and got an import error with no message, and then frustratedly hacked my way through two ExpressionEngine addons and two more Disqus test accounts before I got everything straightened out. For the record, I’d recommend going with CX Disqus Comments if you also run into problems.

Step 2: get EE posts into Markdown files.

Once again, somebody else did most of the work for me. This time it was Derek Jones with the Download Content plugin for ExpressionEngine. I created a template that listed all my posts, each with a link that would download that post in a Markdown format I specified1. I just command-clicked on each item (silly and effective) and ended up with a folder of posts ready for Statamic.

{if member_group == 1}
    {exp:channel:entries 
        channel="blog" 
        limit="999"
    }
    <a href="/post-downloader/{entry_id}">{title}</a>
    <br/>
    {/exp:channel:entries}
{/if}

post-list (template)

{if member_group == 1}
{exp:channel:entries 
    channel="blog" 
    limit="1" 
    entry_id="{segment_2}"
}
{exp:download_content filename="{entry_date format='%Y-%m-%d'}-{url_title}.md" parse="inward"}
---
title: "{title}"
featured: no
---

{blog-summary}
{blog-body}

{/exp:download_content}
{/exp:channel:entries}
{/if}

post-downloader (template)

Step 3: make that new theme.

I copied "london-wild" and went to town with it. As you can guess from my site, half my work was just deleting things I didn’t use. Coming from EE, the theming process felt very familiar. Imagine ExpressionEngine with native Structure bits, but mustachey-looking.

The only sacrifices I had to make were dropping an email contact form (for now) and doing without numbered pagination.

Step 4: consider the URLs.

My blog posts went from /blog/entry/title to /blog/title, so I added a line to .htaccess for redirects:

Redirect 301 /blog/entry/ /blog/

Since I had only six pages of blog posts, I added quick-and-dirty redirects for EE’s pagination links too:

Redirect 301 /blog/P6 /blog?page=2
Redirect 301 /blog/P12 /blog?page=3
Redirect 301 /blog/P18 /blog?page=4
Redirect 301 /blog/P24 /blog?page=5
Redirect 301 /blog/P30 /blog?page=6

Step 5: launch.

The easiest part. Moved all the EE stuff into a doomed folder, dropped all my files right into the doc root via Git. And then I … here’s the thing … and then I was done. I hope you have a rocking time with Statamic too!


  1. Note that my blog posts were previously split into two fields, blog-summary and blog-body. Yours will almost certainly be different.

***

Tagged

    Updated 6/16/19 at 7:44pm