Moving from Nucleus to Wordpress
Posted on August 23, 2006, under Web Dev/Tech.
I made it through the transition from Nucleus 3.23 to Wordpress 2.0.4! I went through the route of importing my old blog items through a really large RSS feed, since no robust scripts exists to import specifically from Nucleus. Here are some tips in case you are considering a similar transition:
The Bad News First
Before you go down this route, you should know three things about this process that won’t make you happy:
- You will lose comments.
- You will have to manually re-add all the images in your old posts.
- You might have broken links to your old posts (there are workarounds).
If you are able to stomach those losses, the process really isn’t too bad. I banged my head a little bit getting the RSS feed into Wordpress, but figured out some clean-up I had to do. Once that was done, Wordpress ate it right up and I was off to choosing a new theme.
Export Nucleus RSS Feed
In order to import all my old posts, I needed Nucleus to make them all available via a really large RSS feed. Wordpress then processed this RSS feed file, and parsed out the entries and dates. Wordpress even created categories based on the categories in the RSS feed, which was very nice.
To begin the import process on your own blog, log into your Nucleus admin panel. From there, go into the Skins, and edit the “Main Index” for the “feeds/rss20″ skin. You should see a line that looks similar to the following:
<%blog(feeds/rss20,12)%>
The last number (12 in this case) tells Nucleus to add the last 12 blog posts into the RSS feed. So you want to set this number to be larger than the total number of posts you have to import. For instance, if your blog has 485 posts, you could safely change that line of code to include 500 posts by changing it to the following:
<%blog(feeds/rss20,500)%>
When you have the number set correctly for your blog, click the “Update Skin” button. Now, go to your blog, and open up the RSS feed in your browser. You are going to have to do some sanitization to the file before you can import it into Wordpress, so save it off to your computer. I’ll walk through the clean-up I had to do next..
Clean Up the Nucleus RSS Feed Before Import
When I tried to import the Nucleus-generated RSS feed, Wordpress kept choking. I was worried the importer didn’t work right, but figured out I needed to ‘massage’ the RSS feed a little bit to help the process.
I ended up needing to remove several tags and strings from the RSS feed. To do this, open up your favorite text editor that can handle doing search and replaces. I ended up using TopStyle Pro, as it can handle Regular Expressions inside of the find/replace dialog. I won’t go into super detail on each replace I did, but here are the items I stripped out of the RSS feed. With each item, I just replaced it with a space. I only wanted each item to be removed from the RSS file, and didn’t need to replace them with anything. Some of items are in Regular Expression format, so you may need to adjust accordingly if your text editor doesn’t support that:
- <![CDATA[ (not Regular Expression)
- ]]> (not Regular Expression)
- <link>.*</link>
- <guid.*</guid>
- <comments>.*</comments>
While I was at it, I also replaced <b> and </b> with <strong> and </strong>.
Import the Nucleus RSS Feed into Wordpress
After you’ve cleaned up your RSS feed from the step above, it should be a snap to get your blog items into Wordpress. To import your RSS feed, just follow the steps from the Wordpress support site.
Redirect Nucleus Links to Wordpress Items
As I mentioned in the opening Bad News, when you switch blogging platforms, your links change for your blog posts. This means anyone, including search engines, linking to the old location of your posts won’t find them.
One nice thing with search engines, is that eventually they will spider your site and find all your new blog post locations. So that’s not a huge deal, unless you get a lot of active traffic on certain posts. Then you may decide there are some you want to redirect to their new location. In my case, I’ve been monitoring stats for awhile and decided only a small percentage of my posts needed to be redirected. The rest could be picked up organically.
To handle redirections, I used an Apache .htaccess file and mod_rewrite. If you set up friendly URLs (Customized Permalinks) in Wordpress on an Apache server, you more than likely already have an .htaccess file that you could append to. Here is a simplified example of an .htaccess file I might use to handle redirecting certain posts:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /jess/
RewriteCond %{QUERY_STRING} ^itemid=594$
RewriteRule ^index.php /jess/2006/07/13/my-wifes-cousin/? [R=301,L]
</IfModule>
SitePoint has an excellent mod_rewrite tutorial for the basics, but I want to point out a couple items specific to comparing and handling query strings.
When I set up Nucleus, I didn’t use friendly URLs, so my post URLs looked like this:
http://www.collicott.net/jess/index.php?itemid=594
To catch links to that URL and redirect them to the new post location, we have to compare what is being passed in the query string. To do this, write a RewriteCond that checks for a particular value. As in the .htaccess example above, you could do that by using the %{QUERY_STRING} variable:
RewriteCond %{QUERY_STRING} ^itemid=594$
That will match URLs that have “itemid=594″ at the end of the query string.
One final tip to pass on regarding query string that would have saved me quite a bit of debug time: If you do query string matching as described above, Apache will append the query string to the end of the new URL by default. This means I was getting “404: Not Found” errors because Apache would redirect to the following URL:
http://www.collicott.net/jess/2006/07/13/my-wifes-cousin/?itemid=594
Wordpress would choke on this URL since it didn’t know what to do with the “?itemid=594″ on the end, and would display an error page. After quite a bit of searching, I found that you could prevent the query string from being automatically appended to the URL by adding a “?” character to the end of your RewriteRule. So instead of:
RewriteRule ^index.php /jess/2006/07/13/my-wifes-cousin/ [R=301,L]
I needed to use:
RewriteRule ^index.php /jess/2006/07/13/my-wifes-cousin/? [R=301,L]
This fixed the issue, and then the redirect worked beautifully. Adding the “?” at the end of the rule to suppress the appending of the query string seems counter-intuitive to me, but I’ll give the Apache group the benefit of the doubt and just roll with it.
Re-Adding Images to Your Posts
I don’t think there is a pretty way to handle this issue. Nucleus doesn’t include image tags in the RSS feed by default, so you can’t do a search and replace to get your images back in. You’ll have to FTP your images down from the Nucleus repository, and just go through post-by-post and add the images back in that you want. Not very fun, but it looks like that’s the way it has to be done if you go this route.
Make It Your Own!
At this point you are done with Nucleus, and can beginning learning all the ways you can customize your new Wordpress blog. Have fun!
8 Replies to "Moving from Nucleus to Wordpress"
jess on December 30, 2006
You’re welcome Chris!
cjkinniburgh.com » Welcome to WordPress. on December 30, 2006
[...] I made it through the transition from Nucleus 3.23 to Wordpress 2.0.5! I went through the route of importing my old blog items through a really large RSS feed, since no robust scripts exists to import specifically from Nucleus. I guess I have to tell you you guys will have lost all your comments, however I really was dying with Nucleus, and it was a big part of my lack of recent posts. Anyways, I just wanted to tell you to definitely check out Jess Collicote’s website, with the tutorial that helped me out a bunch through this process. A big shout out to her. [...]
Billy Dale on May 18, 2007
Awesome! Now I can rid or Nucleus without manually reimporting 60 posts. Thanks!
Kunal on July 1, 2007
You can use a Nucleus – to – Wordpress script available from sourceforge:
To Hell in a Handbasket » Blog Archive » Nucleus is Dead, Long Live WordPress on December 15, 2007
[...] For those unfortunate to still be using Nucleus, and wanting to upgrade to WordPress, do not be intimidated by the conversion process. You will lose your comments, but the content, images, categories, etc. is all salvageable. I simply used the RSS feed from my Nucleus site as an export tool, performed some minimal search/replace on the XML file, and then imported it into WordPress. It was very painless. I was lucky enough to use the lessons learned from a fellow convert who has a very detailed explanation of the upgrade process here. [...]
The Jealous Toaster » Blog Archive » Redesign puhlease! on January 8, 2008
[...] found this method that talks about exporting the RSS feed from nucleus into wordpress. Buuuut, you lose [...]
Migrating from Nucleus to Wordpress | The Reconstruction on December 15, 2008
[...] I found this post on the migration to be really useful. The technique used consists of simply writing out all the [...]
ckinniburgh on December 30, 2006
Thank you very much for this! I loved the guide and it was insanely useful. I read how you did it and started working right away assuming that with the basic knowledge that there was no exporter and to use RSS feeds I would have no trouble. Two minutes in I couldn’t find where the damn RSS settings in Nucleus were! (I hate the damn CMS and have wanted to change for a while!) Anyways I thankfully saw your post and you helped me through!
Thanks again!
Chris