Textpattern To WordPress Migration And Importer Updates

After many years on the Textpattern blogging platform, I’ve migrated Place Name Here over to WordPress. Though it only took a day or two to migrate blog posts and comments dating back to 2004 and create a theme to match, it was a move that needed some massaging.

Why Change?

I had been contemplating the change for some time now. I’ve used both systems, as well as others like Movable Type, for personal and client projects and have a good feel for each system’s strengths. I was seeing that where WP was headed is more aligned with where I think I want to take this site. It isn’t that there was anything wrong with Textpattern—in fact in many ways I still prefer it’s simplicity, template system and other core features. But that project seemed to have plateaud and contributions, updates and roadmaps are sometimes unclear. WordPress has continued to move forward and make easier some of the features I’ve been wanting to add (pingbacks, gravatars, other blogging and infrastructure fluff). But since these weren’t pressing needs, I just kept bumping the move until recently when I had the time to look at it again.

Data Importer Hiccups & Changes

Having a relatively simple markup structure to begin with for the old site’s templates made the theme transition relatively easy. By creating a child theme of Twenty Ten and editing just 9 of the files (along with a bit of experience) got me to what you see now. Given this is only a migration of a 2+ year old markup and CSS that’s been tweaked a few times too many there is certainly cleanup that needs to be done when I get a chance, but a redesign is another challenge for another day.

What I did have to wrestle with was the data migration. The current Textpattern importer plugin seemed a bit out of date and for my needs it needed a bit of customization. The requirements I laid out for a successful migration from Textpattern 4.2.0 to WordPress 3.0.1:

  1. Post author needed to remain my user account in both systems.
  2. Old permalinks needed to work, so /article/[ID]/[textstub] needed to be configured and IDs in the old system needed to be preserved.
  3. Tags needed to be migrated from the old system to the new.
  4. Post Body and Excerpt HTML fields needed to be imported so I didn’t have to configure Textile parsing for all old articles.

Items 1 and 2 required a little massaging before import.

  1. Create the WordPress admin user with the same username as the author in Textpattern.
  2. Delete all test posts, comments and pages from the MySQL database to free up any IDs.

Customization of the textpattern-importer plugin was required to make the rest happen. It wasn’t really a heavy job, but three changes needed to be made.

Swap the use of the Body and Excerpt containing Textile code with the “compiled” Body_html and Excerpt_html fields.

// Get Posts
return $txpdb->get_results('SELECT
	ID,
	Posted,
	AuthorID,
	LastMod,
	Title,
	Body_html,
	Excerpt_html,
	Category1,
	Category2,
	Status,
	Keywords,
	url_title,
	comments_count
	FROM '.$prefix.'textpattern
	', ARRAY_A);

Include the Keywords field (was this just overlooked? I don’t understand why it wasn’t there already). Also, insert the existing ID for each inserted post (as import_id).

$ret_id = wp_insert_post(array(
	'import_id'			=> $OldID,
	'post_date'			=> $Posted,
	'post_date_gmt'		=> $post_date_gmt,
	'post_author'		=> $authorid,
	'post_modified'		=> $LastMod,
	'post_modified_gmt' => $post_modified_gmt,
	'post_title'		=> $Title,
	'post_content'		=> $Body,
	'post_excerpt'		=> $Excerpt,
	'post_status'		=> $post_status,
	'post_name'			=> $url_title,
	'tags_input'		=> $Keywords,
	'comment_count'		=> $comments_count)
	);

What To Do With The Code Now?

I feel the need to share, but is it worth submitting back to the project?

I’ve uploaded both my customized importer plugin and a diff incase anyone else should want to attempt to use it. Please read my requirements above before you do, but it will probably be a smoother transition than the current plugin. I’d love to discuss contributing the changes back into the project with someone, but wouldn’t lobby for it without some discussion of which of my requirements are universal enough to make it (keywords, yes, HTML posts, dunno). Please use the comments section to let me know your thoughts on contributing this code back to WordPress—or report back if you’ve used the code.

Download pnh-textpattern-importer.zip which contains:

  • textpattern-importer.php: (replace contents of /wp-content/plugins/textpattern-importer/textpattern-importer.php with this file after installing existing plugin)
  • textpattern-importer.php.diff

Things I Should Have Blogged This Week

one big alt

Instead of writing about these things this week I let them fly into the twitter, IM, or news reader ether likely not to be mentioned by me again. Maybe I’ll make this recap a semi-regular features on this site as I expect to be quite busy over the next couple of months.

In The Web Standards World

IE8 Standards Mode Blacklist

The fiasco of the week in the web world is the Internet Explorer 8 Standards Mode opt-in-or-not-opt-in behavior for large sites that get reported as not working well in IE. Here’s the blog post that kicked the discussion off.

Molly mentions it — along with announcing she has a new position at Opera! Andy and many respond on For A Beautiful Web, coworker Michael Bester shows his sympathetic side. All required reading. And Via Twitter IE team member Chris Wilson mentions that there may be more clarification for web site owners and managers is to come.

And Then Those Other Yahoo’s…

Not content to sit on the sidelines in the ‘you need to include this new tag in all your pages’ game, this week Yahoo, Google and MSN have announced support for a new link rel value “canonical”. The SEOmoz blog has great coverage in Canonical URL Tag – The Most Important Advancement in SEO Practices Since Sitemaps. The really short of it is that adding code like <link rel="canonical" href="http://placenamehere.com/tag/seo"> in the top of the page will wrap all the duplicate indexed pages at other domains [www.] or other addresses [?tag=seo] into a single entry in search results.

[Re]Launches

  • Errorlytics gets an official launch. It is an interesting take on web services and customer service letting you easily manage complex rules for dealing with 404 errors. If you’re running a site with many pages or one that’s gone through a few redesigns check it out.
  • Accession Media, a web development and marketing firm I work with on occasion has relaunched their own site with a new look and tighter focus. They’re also the team behind Errorlytics.
  • Michael Raichelson has as fun new tumbler template up on HACKADAISICAL!COM
  • In the wake of the meltdown at ma.gnolia I’ve moved back to using my delicious account for storing and sharing bookmarks.
  • Amazon.com announced the Kindle 2 in part via a giant JPG splashed up on their home page complete with imagemap to reproduce the behavior of the text links in the copy. The big image was not to be outdone by the bigger contents of the image’s alt attribute which included the full text of the letter from Jeff Bezos. I don’t know about you, but I’d be fired if I ever attempted that on a client’s site — and for good reason.

one big img

New In Print

My State of Textpattern

Drew McClellan has just posted The State of Textpattern over on his site. Drew is not a core TXP developer, but a long time user who has seen the product change and change hands over its life. His concerns are no surprise to me, as we’ve often gone back and forth over IM trying to ease each other’s frustration with the state of the project.

I think Drew has covered most of my frustrations in his State of Textpattern address. I’ve been using it since the Place Name Here redesign in late 2004, and evaluated it for other projects before and used it since. In that time there are some enhancements to the sites I’ve done via other’s plugins, plugins written myself after I’ve seen a need, times when I’ve done things simply to participate in the community and make it look like it had some life [like the theme contest and been in the code enough to know how it works and make a fair amount of my own customizations.

But as time has passed, like Drew, I find myself both concerned and hesitant about continuing to contribute in any way, or keeping it in future plans for my own sites.

I don’t use the product in my typical day to day web development duties [projects are bigger, using other often custom frameworks or languages besides PHP] but I occasionally find myself with time outside of work that I could offer to the project if the motivation was there.

When motivation and time align – the occasional contributor

The times in the past when both motivation and time have aligned and I’ve made contributions like the microformat plugin. The times more recently when that has been the case, were time and motivation to revise my plugins or look for other things to enhance [hAtom templates or OpenID as examples], I haven’t had enough confidence in the project to justify the effort. “Big” changes that have been talked about forever like admin side redesigning or the decision to include [or not] a particular JS library would have a big impact on how I should approach my code and what features I think are a priority. With no development roadmap in sight [again not a timeline, just a commitment to features or general development direction] and no assurances that what has been done in the so called experimental branch will be there next week I find it impossible to plan my own contributions.

And that’s my own biggest area of frustration for the last few months. My investment in any particular product on my own blogs is light. I could jump to WP or EE or some other solution in a weekend and be done with TXP and onto plotting how to address my peeves with the new platform. The investment in a product that others might be downloading and using is a bit more difficult for me to abandon.

The wrong things take work

As much as the direction [or lack there of] is a concern, its only the latest symptom of a something that has always plagued textpattern.

The way product development has been handled since it was opened up to a larger, more open team, has always been difficult to follow. It is a chore to cover the forums, blogs and mailing lists on a regular basis. That their use by the core team go in spurts and ultimately most of the insight into the product comes in the form of replies to inquiries on the forums or individual code checkins only makes it more difficult. Unless it is your job to do so and you’re building sites with TXP on a day to day basis, the commitment that needs to be made before one can just jump in and be a productive contributor has been too great.

Its nice that a core team has formed over time and they’re now looking for ways to sustain themselves, but I agree 100% that its the the lack of open direction, and the occational feeling from some contributors that direction doesn’t need to be or is somehow in a state of development where it cannot be stated that has me concerned and questioning continued use and support of textpattern.

Released: Textpattern Microformat Plugin v1.2

I’ve just updated my microformat plugin for the textpattern CMS and blogging tool. This update is a maintenance fix to add support for Textpattern v1.0.4 and some changes made in the way tag helpers are built. Users of older versions of TXP should stick with the 1.0 version of the plugin.

Future updates to the plugin are planned to add additional microformats support, expand the flexibility of the tag helpers and to streamline the underlying PHP code. If you’re using this plugin — or have chosen not to — please help by posting a comment letting me know how well you think it fits into your writing style.

Redesign: The New Place Name Here

Hey look, I did it!

After roughly six months of sitting on a design I was happy with I’ve found both the time and ambition to finish building an update to Place Name Here. Not quite sure what version of the site this is, but 6 seemed like a good number when I started.

Like with all previous versions of the site the new layout is fairly simple, and doesn’t use a lot of images or tricks to play things up. This site always proves to be difficult to rebuild in a uniform way because of the patchwork of different side projects, and technical demos that have been posted since the site first launched in late 1998. The new design and slightly rearranged navigation will hopefully help give a better perspective of what is hiding on the site.

Though not glitzy, there are a few tricks hiding in the new design which I’ll cover in detail in a future post. One element in particular is the code used to create a “liquid” like layout via JavaScript. If you are reading this and seeing a two column layout the left column is made of content that has been pulled out of the main column and repositioned to fill the gap on the left. This is similar to using floats where content will stack if there isn’t enough room to go side by side, but in this method I can pull content from anywhere in the flow of the main column depending on the given page — introduction content from the top, extra content from the bottom, or something I’d like to highlight from the middle.

Another new site feature is the beginning of better integration with the aggregated content on Place Name Where?. This can be seen in the combined tag searches found on pages such as the PHP tag page. This was really what I build the mechanics behind PNW for, but hadn’t gotten to any implementation before this redesign.

More about the guts of the site can be found in the updated colophon. Please take the new look for a spin and let me know what you think in the comments.