This post is in English to make it available to a wider international audience. When I was trying to find hints or tutorials for migrating my long-term Textpattern site to WordPress, I hardly found anything that wasn’t several years old. So I’m documenting my approach hoping that some will find it useful.
I’d been running my blog rete-mirabile.net using Textpattern as its CMS for eleven years. The site structure was elaborate, about 400 posts had accumulated in that time. While Textpattern (TXP) is – in my opinion – still a CMS that has its place and can build complex sites with an elegant back-end, it is not a modern blogging system. I found it lacking in areas such as the comments (moderation, spam prevention, comment subscriptions), integration with other web services, integration with desktop blogging apps (which I’d like to use), themes (especially mobile ones), and Markdown support (which has become my favourite writing syntax). Recently, I started a new blog using WordPress (WP) and realised that WP had developed into a powerful blogging engine during the years I hadn’t been looking at it. So I decided to migrate my blog from Textpattern to WordPress.
- All post content including images and files should be brought over.
- Manual work should be avoided as much as possible.
- URLs have to keep working (because Cool URIs don’t change).
Looking for workable approaches
Getting content out of Textpattern
Most ideas, scripts and tutorials I found were several years old. Since both TXP and WP have changed significantly during the last couple of years it was unlikely that they were still going to work. Still, I documented all that I found in my Pinboard account.
I did find a newer approach on Simeon Griggs’ site Tomoro. He suggests making a dedicated Textpattern page that will turn out an XML file which can then be imported into WP. That worked for me but had one major drawback: The generated XML file showed post URLs based on post titles. But I had used custom post URLs (WP calls them »slugs«) in many articles so many of my post URLs would be broken and would have to be corrected manually.
I then found Drew McLellan’s Textpattern-to-Wordpress script. It turned out that this script extracts almost all the data needed including post slugs. So I had a workable way of getting my content out of Textpattern.
Importing into WordPress
For importing I found the excellent WP All Import plugin. It has many options to match the contents of an XML file to different fields of the WordPress database. The free version did the job for me but if you have more complex needs there’s a paid upgrade which makes the plugin even more flexible.
The plugin can do a »dry run« showing you what it’s going to do when you really run the import. This is handy to find problems or errors before you actually put a lot of entries into the database.
Each post in Textpattern can have one »section« and two »categories« as well as tags. I matched TXP sections to WP categories giving each post in WP one category. So categories were to be my equivalent of sections. Since there is no exact equivalent for TXP-categories then I matched them to tags in WP (the WP All Import plugin can handle such matching very easily).
One shortcoming of the Textpattern-to-WordPress script is that it doesn’t extract tags. First I thought: forget tags. But then I realised that I had made a lot of effort over the years to tag my posts thoroughly and extensively so I decided to invest some time to bring the tags over by hand. For the about 400 posts this took about 2 – 3 hours.
Importing images and files
TXP and WP put images and files in differently named folders. But since images were linked to by their proper file names in TPX, I simply copied over the whole TXP images folder and put it in the matching position within the folder structure so that all image links were correct. New images will be put in the WP folder structure, old images would live in the TXP-generated images folder.
With files, it was more difficult. I had used TXP forms to make a special post-type when I offered files for download so the file URLs were not part of the post body and therefore didn’t get imported. I manually uploaded all files which wasn’t a problem because WP has drag-and-drop batch upload. But then I had to edit all posts which contained file downloads manually. Again, this took some time.
My TXP site had URLs based on sections:
rete-mirabile.net/section/post-slug, to make matching URLs in WP, I set the URL structure (in Settings > Permalinks) to:
I also changed the keywords for categories and tags to make them match their corresponding settings that I had used with TXP.
In the end, migrating the TXP site to WP was easier than I had thought. It did take a couple of hours but I’m now very content with running my site on WP and having all previous content in the same place as before so that people can find it without problems.
I hope this post helps others who might want to do the same.