Skip to Main Content

Migrating EE1 to Statamic

I have just migrated Repatriate Me! from ExpressionEngine 1.6.8 to a new CMS called Statamic. The reason this was migrated to Statamic is that it was built on an older free version of ExpressionEngine which no longer exists. All available versions are commercial and it was not worth upgrading the software and paying licensing costs.

I have just migrated Repatriate Me! from ExpressionEngine 1.6.8 to a new CMS called Statamic. The reason this was migrated to Statamic is that it was built on an older free version of ExpressionEngine which no longer exists. All available versions are commercial and it was not worth upgrading the software and paying licensing costs. The site did need to be upgraded due to it's age and the site need a completely new look so Statamic was chosen as it's perfect for small sites and blogs.

Additionally the licensing cost for a personal license is only $20 and it comes with baked in image resizing on the fly within your templates, a matrix style field and tagging all of which ExpressionEngine requires paid addons to cover.

Migrating all my entries to statamic required a little bit of preparation which this blog post helped out immensely. The issue I had is that the key to making the move smooth was an add-on that is only available for ExpressionEngine 2, Download Content. My workaround to this required a fair amount more work, but for a one off migration it worked fine.

I created a test template group and in the template put the following code which output a list of all entries.

    
    
      {exp:weblog:entries weblog="blog" limit="500"}
  <a href="/site/test/single/{entry_id}/{entry_date format='%Y-%m-%d'}-{url_title}">{title}</a><br/>
{/exp:weblog:entries}


{entry_date format='%Y-%m-%d'}-{url_title}.md<br /><br />
    
  

Then I created a second template called single with the following code to migrate my fields to markdown. The key to getting a downloadable file without weird formatting was to set the template type to CSS.

    
    
      {exp:weblog:entries weblog="blog" limit="{segment_3}" }
---
title: "{title}"
tags: {tags}
summary: '{entry}'
bcontent: '{extended}'
vimeoyoutube:
{vimeo}
  -
    video_service:
    video: {video}
    video_title: {vid-title}
    video_description: {description}
{/vimeo}
---
{/exp:weblog:entries}
    
  

After this was done, I needed an easy way to get all the files to my computer. I used FireFox and an extension called Download Them All. I then visited the first template above and ran the Download Them All extension. On the bottom right of the screen that pops up there is a renaming Mask option. I used this setting *name*.md and everything was named correctly.

This still wasn't perfect as Statamic choked on the raw output for thee reasons. At the top of the file there was a line break which I couldn't for the life of me figure out how to remove. Additionally all of the HTML was beautifully formatted and tabbed with line breaks, but Statamic required the markdown file to have no line breaks within fields. Also since I was using a tagging field in ExpressionEngine that was comma separated tags, but Statamic required line breaks and dashes I had to manually rework all tags.

You can see that in EE the vimeo field is a matrix which only had three cells. In Statamic I migrated that to a grid field with a fourth cell called service. In my templates I've used a conditional to display either YouTube embed code or Vimeo embed code depending on which video service is selected.

Bad (extra line break at the beginning is being lost here):

    
    
      ---
title: "Flight Confirmed"
tags: ottawa, travel, canada, planning, 
summary: '<p>Last night my wife and I went out for dinner without the kids (it&#8217;s been a long time since we last did that) and we were talking about <a href="http://repatriate.me/site/blog/single/ottawa_july_4_to_july_13/">my trip to Ottawa</a> this summer. As I mentioned in an earlier post the flight is booked but for the return portion I was on a waiting list. The thing is I could get off the list by spending more airmiles to fly business class. Well over dinner we decided to use the airmiles to do that.</p>

	<p>Around 10pm last night we received a text message that the flight was confirmed. I&#8217;ll now be flying economy and not using the extra 20,000 miles needed to upgrade. I&#8217;m happy about saving the miles, but after having decided to use them am also a little disappointed to not be flying business class &#8211; Seoul to Toronto is about 15 hours and that&#8217;s a really long time to be cramped like a sardine.</p>

	<p>Oh well, I&#8217;m happy everything is confirmed. Now I need to book a room and arrange a car rental.</p>'
bcontent: ''
vimeoyoutube:

---
    
  

Good - I had to manually remove all extra spaces and linebreaks within all fields

    
    
      ---
title: "Flight Confirmed"
tags: 
	- ottawa
	- travel
	- canada
	- planning
summary: '<p>Last night my wife and I went out for dinner without the kids (it&#8217;s been a long time since we last did that) and we were talking about <a href="http://repatriate.me/site/blog/single/ottawa_july_4_to_july_13/">my trip to Ottawa</a> this summer. As I mentioned in an earlier post the flight is booked but for the return portion I was on a waiting list. The thing is I could get off the list by spending more airmiles to fly business class. Well over dinner we decided to use the airmiles to do that.</p><p>Around 10pm last night we received a text message that the flight was confirmed. I&#8217;ll now be flying economy and not using the extra 20,000 miles needed to upgrade. I&#8217;m happy about saving the miles, but after having decided to use them am also a little disappointed to not be flying business class &#8211; Seoul to Toronto is about 15 hours and that&#8217;s a really long time to be cramped like a sardine.</p><p>Oh well, I&#8217;m happy everything is confirmed. Now I need to book a room and arrange a car rental.</p>'
bcontent: ''
vimeoyoutube:
---
    
  

What this meant in the end is that I had to manually open each markdown file and edit it. While time consuming it wasn't difficult and the templates above did most of the work of getting the my content into the correct format.

In any case go check out the new site which is now also fully responsive - Repatriate Me!