Moving From Mango to WordPress


When I decided to flip from using Mango Blog to using WordPress, I didn’t really find any guides or articles talking about the process, so I thought I’d share what I did in case anyone else decides to make the same move, especially with Mango seemingly abandoned.  I was on mango 1.7 (released April 2013) and moved to WordPress 4.3, which was the current version at the time (it’s now at 4.4). 

I didn’t change hosts at the time, which made it easier to deal with the file stuff, though I did change domains which added a few extra steps, which I’ll note below as well.

Step 1: Take It Down and Backup! Backup!! Backup!!!

Since you don’t want content changing during the migration, make sure to take your site “offline”.  I did this with just a simple htaccess and a static HTML site to redirect everyone except me to a notice about the update.

This step probably goes without saying, but I’m saying it anyway.  Make sure you’ve downloaded your entire current site and zipped it up as a backup (or better yet, final commit to your SVN or GitHub then tag it off). 

RewriteEngine On
RewriteBase /

RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{REQUEST_URI} !^/siteDown.html$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/siteDown.html

# Custom Error Pages
ErrorDocument 400 /siteDown.html
ErrorDocument 401 /siteDown.html
ErrorDocument 403 /siteDown.html
ErrorDocument 404 /siteDown.html
ErrorDocument 500 /siteDown.html

Download your current database as a back up to (and make sure you download it in a restorable format!).  In the case of MySQL, download the single SQL file, compressed or not.  So much easier to work with.

Step 2: Get Current RSS

For importing the entries into WordPress, I was originally going to write a bunch of queries to import them all “properly” or whatever, then I realized using the RSS import was so much easier to work with.  It does the bulk of the work and keeps you from having to do any major wrangling to try to mesh how Mango does things with how WordPress does it.

However, to use the RSS, you first need to make sure you are getting ALL of your entries.  By default, the RSS only shows 15 entries.  So open /feeds/rss.cfm and change line 25 to remove the limit.

RSSChange

Upload the updated version then go download your now complete RSS feed from the site and save it somewhere easy to find.  If you don’t have your RSS available to readers, go to [YOURURL]/feeds/rss.cfm (duh) 🙂

Now in my case, I only had 120 entries or so, so this was a nice small file, easy to work with.  If you have several hundreds or thousands, to the point the RSS is unwieldy, you may need to use the count and other Mango tag options to pull multiple RSS feeds in batches.

Step 3: Move Assets, Then Clear Out Mango

Since it’s not really much fun to break all your images and links in your old posts, you want to keep those available.  You could just leave it where it us, under /assets/content/ so it all just still works.  But I wanted better organization of my stuff and I didn’t want to leave any mango stuff behind, so I moved my assets folder up to the root and renamed it.

This also made it easier to then go in and delete all the Mango stuff from my site.  I left my various .htaccess files, favicon, and the like, of course, as well as my non-Mango stuff like my guessing game sample app.

Step 4: Install and Set Up WordPress

Download the current version from WordPress.org and follow the simple set up instructions.  I would recommend putting it in a different DB from mango for cleanliness sake and changing the table prefix for a mild security boost.

I would also go ahead and set up your theme and plugins, so that you have a functioning, ready to go site.  For settings, at the bare minimum, set up your user account and go through the Settings for General and Permalink so that your import will come through with your basic settings.

In terms of WordPress plugins, obviously you can pick whatever works for you.  At minimum, for this process, you want the RSS Importer and probably the Categories to Tags Converter Importer.  Both of this you can get the links to from Tools > Import.

A few other plugs in I like to have on most WordPress installs and that I generally recommend:

  • Akismet – spam protect, it comes with WordPress, you just have to activate it
  • Disqus Comment System – if you use Disqus, you will want the plug in!
  • Enhanced Media Library – allows you to add taxonomies to your uploads, including categories. Handy for grouping and making it easier to find things like sliders, featured posts, etc.
  • Jetpack by WordPress.com – from the makers of WordPress, this thing comes nearly 30 individually configurable components, including the Like/Share buttons regularly seen on WordPress.com sites, contact forms, enhanced distribution options, extra widgets, etc. For me, this thing is worth it alone for the excellent site monitor that alerts you to outages, widget visibility options, and the spelling/grammar checker that plugs right in to your editor.
  • TinyMCE Advanced – because the basic TinyMCE editor sucks and can’t be reconfigured without going through code changes
  • UpdraftPlus Backup and Restoration – automated back-ups for things like this is awesome; don’t just trust your host! Updraft is particularly nice as it also has the ability to do porting from one WordPress to another if you switch hosts and has a lot of options available in the free version
  • Yoast SEO – if SEO matters to you, this is a robust plug in for seeing your SEO scores on posts and giving suggestions for tweaking it. I suck at it, but it’s still useful info 🙂

Also, if you do a technical blog like this and you use SyntaxHighlighter (or something similar), you’ll want to deal with that too.  There is a plug in for it, which is an official WordPress plug in which gives you short codes you can use for new entries.  For existing entries, make sure to go into its settings and check the box for “Load All Brushes” so that it will go ahead and put in the JS to recognize the pre tags. On the whole, it works well, though I did find it sometimes gets wonky with TinyMCE Advanced and wants to throw in pretags too which can break entries a bit. So keep an eye on that.

You can also manually install it into your theme, but that requires childing your theme, then adding the JS and CSS files, modifying your header.php, and some hooks in your functions.php.  As SyntaxHighlighter isn’t being updated constantly, I’d just use the plug in myself. 🙂

Step 5: Fix the RSS

Before we use the RSS feed we got, we need to fix it.  Open it in your favorite IDE or text editor (Dreamweaver in my case), and do a search/replace to update all instances of [YOURURL]/assets/ to /[WHEREEVER YOU PUT THE FILES].

If you left them where they were, you can skip this, though I would go ahead and at least strip out all the hard coded URLs, so that your site remains more portable in the future.

Step 6: Import Entries

Okay, all set up?  Cool.  Now, back up the DB again, just in case, then go to the RSS importer and import the RSS file you downloaded earlier.  This went pretty fast for me, but again, I didn’t have a ton of entries.

I should also note: this method does NOT import any of your existing comments.  I use Disqus, so this wasn’t an issue for me.  If you used Mango’s built in commenting system, you’ll have to import those another way, presumably through writing queries to import them to the table. 

Step 7: Fix URLs

If you cross link articles, like most people do, you need to set up something to keep those links working.  In my case, I found I actually had only a few crosslinked, so I just pulled up those entries by querying the DB for the Mango URL schema, then manually fixed them to the new slugs.  Another option is to pop in a plug in like Redirection that you can use to monitor 404s and set up 301 redirects as needed.

If you have a ton of them, you may want to write a script to go through and fix them.  Since I didn’t have to write one, I don’t have sample code, but basically I’d have it pull all entries from your Mango DB with the old URL, calculate the new URL, then go find entries in the new WordPress DB that have those old URLs and replace appropriately.

All Done!

And that’s pretty much it.  You should now have all your content migrated, images working, and your WordPress up and running. 

If you, like me, use Disqus, you will need to do an additional step to update your comments so you don’t lose them.  Make sure you do this BEFORE you turn the site back live!  I’ll talk about the process in a follow up post later.

If you don’t need to update Disqus or a similar system, and everything is working well, then your last step is just the final clean up, i.e. doing final spot checks, removing your site down notices, and dropping the Mango DB.