Here are two scripts that should help anyone migrating from typo (Ruby on Rails blogging platform) to WordPress. The scripts will import articles, pages, comments, categories and tags through a sequence of SQL queries that map fields from typo to their equivalent in WordPress. Simple, quick and beats importing via RSS.
You can download the scripts here: typo_to_wordpress.zip.
Update - 11 Jul 2006: The scripts were updated to incorporate Case Larsen’s comments. Many thanks to him.
The zip file contains two scripts, one with tag support and one without. The script has been tested with typo 2.6.0, WordPress 2.0.3 and Ultimate Tag Warrior 3.1.
Both scripts:
- Remove the example posts, pages and comments from WordPress (including cleaning up the category associations and category post counts).
- Import all the categories from typo into WordPress
- Import all the articles from typo into WordPress (including setting the publish, comment and ping status)
- Import all the pages from typo into WordPress
- Import all the comments from typo into WordPress
- Create all the associations between posts and categories
- Link each comment to its post
- Update the permalink structure for posts and categories to match typo
- Update each category with the correct post count.
- Update each post with the correct comment count.
- Remove the old typo tables
The second script (typo_to_wordpress_with_utw.sql) with Ultimate Tag Warrior (UTW) support also:
- Imports all the active tags from typo into WordPress
- Creates all the associations between tags and posts
- Updates the permalink for tags
- Turns on pretty URLs for tags
Assumptions:
- All times in typo are UTC and the WordPress local timezone is UTC.
- The author of all the posts and pages will be the WordPress admin user
- The permalink structure for posts in typo is: ‘/articles/%year%/%monthnum%/%day%/%postname%/’ (default)
- The permalink structure for categories in typo is: ‘/articles/category/%category_name%’ (default)
- You have just installed a fresh copy of WordPress
Step-by-step guide to the standard script:
- Export the articles_categories, categories and contents tables from the typo database.
- Install a fresh copy of WordPress.
- Import the typo export from step 1 into the WordPress database.
- Run the typo_to_wordpress.sql update script.
Step-by-step guide to the script with UTW support
- Export the articles_tags, tags, articles_categories, categories and contents tables from the typo database.
- Install a fresh copy of WordPress.
- Install the UTW plugin
- Active the UTW plugin
- Import the typo export from step 1 into the WordPress database.
- Run the typo_to_wordpress_with_utw.sql update script.
Finally, it is worth adding the following lines to your .htaccess to maintain the permalinks for your pages and RSS feeds, the line should go directly beneath the ‘RewriteBase /’ line
RewriteRule ^pages/(.*)$ /$1 [R=301,L]
RewriteRule ^xml/rss/feed\.xml$ /feed/ [R=301,L]
If you have used the script with UTW support also add the following line to perserve the permalinks for tags
RewriteRule ^articles/tag/(.*)$ /tags/$1 [R=301,L]
That’s it.
Feel free to comment on the script and suggestion improvements. If you have any problems let me know and I’ll be happy to help.











Please add your comments...