One of the tasks I needed to address on my converstion from Typepad to Jekyll, was to
figure out how to parse the Typepad backup file and convert it into separate post files. At first, I found a perl
script that performed the conversion, but I had some problems on a few posts, where the post title had a single
:, or double quote
As a fun exercise, I wrote my own converter in Ruby.
In my first go, I created a simple Ruby script that performed the conversion from a Typepad backup file into
separate Jekyll posts with the yaml front matter. The Typepad backup file format is a simple text file where each
blog post is delimited by seven (7) hyphens
- and each section, within a post, is delimited by five.
Below is an sample MTIF backup file with a single post and single comment.
AUTHOR: Chris TITLE: First Post STATUS: Draft ALLOW COMMENTS: 1 CONVERT BREAKS: __default__ ALLOW PINGS: 0 BASENAME: first_post UNIQUE URL: http://www.example.org/2003/05/first_post.html DATE: 05/29/2003 01:02:06 AM ----- BODY: <p>This should be my first post to Moveable Type. </p> <p>Jerry</p> ----- EXTENDED BODY: <p>IDEAS:</p> <p>crayons<br /> ----- EXCERPT: ----- KEYWORDS: ----- COMMENT: AUTHOR: Troy Aikman EMAIL: email@example.com IP: 188.8.131.52 URL: http://troy.example.com/ DATE: 05/30/2003 01:32:14 PM Easy, ain't it? :) laters ----- --------
Later, I decided I wanted to repackage my ruby script into a commandline app that would make
this easier for others to use. To install the code, just run
gem install typepad_to_jekyll thor. I used the
Thor gem to handle the commandline interface, which made it pretty easy to setup.
To convert a Typepad site to Jekyll, I followed the steps below. (Running Mac OSX, Mavericks)
Logged into Typepad.com and created a backup of my site.
Settings –> Inport/Export –> Export
Once the export is complete, download the file to your computer and save as ~/Desktop/download_export_sitename_yyyymmdd.txt.
Open the Terminal.app program (Found under Applications/Utilities)
gem install jekyll
Create a new Jekyll site.
jekyll new mysitenameand then
Install Typepad to Jekyll gem.
gem install typepad_to_jekyll thor
To build the posts, run
typepad_to jekyll ~/Desktop/download_export_sitename_yyyymmdd.txt .
All of your posts should be in the
_postsdirectory. Any drafts will be in the `_drafts/ directory.
ls -lah _posts
To view, run
jekyll serve. Then point your web browser to