The technical side of moving a blog from Blogger to WordPress

Recently I had to manage an exodus of Blogger driven posts to this WordPress blog. During the move I learned a few new things, developed a few pieces of code, and thought it might be a good idea to share my experiences. Probably there are other bloggers who want to leave blogspot.com but don’t do it because they are afraid of the aftermaths.

Such a move comes with pitfalls and unavoidable traffic losses, so here is my try to minimize the downsides which you please don’t read as kinda move-Blogger-blog-to-WordPress-guru tutorial.

Loading WordPress with Blogger posts and comments

After installing WordPress on this brand new domain, one of my first steps was to feed it with content, and to announce this content to search engines. Search engines don’t care to index posts totally fucked up due to formating issues, but every indexed URL is an asset I can fine tune later on. I figured that Google would need at least a week or so to index the whole blog and didn’t care much about the other engines, which never sent much visitors to my pamphlets. This week gave me enough time to find the broken pages and to remove PRE tags and HTML comments causing the mess.

I’ve imported my Blogger posts and comments into WordPress using the standard import functionality. Pretty neat script by the way (if it can’t access the Blogger database, look at this plugin). Without even looking at the imported stuff I created an XML sitemap and submitted it to Google (you should submit it to Yahoo! too). In the sitemaps settings I’ve disabled the archives because I really don’t want any engine to index them. Then I created a robots.txt, blocked the archives, and added the sitemap autodiscovery statement so that Yahoo!, MSN and Ask can pick up my new blog too. Replacing the uncrawlable archive pages I’ve created categorized links pages like this one later on.

Now I needed to connect my old blogger posts to the new canonical URLs in order to route the human traffic as well as crawlers to the right pages.

    Here are six technical bits which could be helpful:

  1. The first step was getting the mappings from the blogspot URLs to the new pages. Extracting this info from formatted sources was no option, so I connected to my WordPress database and submitted this query to get the raw data:


    SELECT wp_posts.ID,
    wp_posts.post_title,
    wp_posts.post_name,
    wp_posts.guid,
    wp_postmeta.meta_value
    FROM wp_posts
    LEFT OUTER JOIN wp_postmeta ON (wp_postmeta.post_id = wp_posts.ID)
    WHERE wp_posts.ID > 1 AND wp_posts.ID < 176
    AND wp_posts.post_status = 'publish'
    AND wp_posts.post_type = 'post'
    AND wp_postmeta.meta_key = 'blogger_permalink'
    ORDER BY wp_posts.ID
    LIMIT 176
    (ID #1 was the generated welcome post, and #175 was the ID of the last post imported from Blogger)

  2. Next I wanted a flexible and persistent data source to make use of the Blogger-URL relations for various purposes, so I created a routing table (joins are too expensive, VIEWs were introduced by MySQL 5.1 and I run an older version) to store the URL mappings (Blogger to WordPress) and populated it from the query above:


    CREATE TABLE IF NOT EXISTS `wp_blogger_url_maps` (
    `bum_id` BIGINT( 20 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `post_id` BIGINT( 20 ) NOT NULL ,
    `post_title` VARCHAR( 255 ) NOT NULL ,
    `post_name` VARCHAR( 255 ) NOT NULL ,
    `guid` VARCHAR( 255 ) NOT NULL ,
    `bum_blogger_rel_url` VARCHAR( 255 ) NOT NULL ,
    UNIQUE ( `post_id` ) ,
    INDEX ( `post_title` ) ,
    INDEX ( `post_name` ) ,
    INDEX ( `guid` ) ,
    INDEX ( `bum_blogger_rel_url` )
    )
    CHARACTER SET utf8
    COLLATE utf8_general_ci

    Of course you should do that with a script written in a way that you can repeat this procedure. While you’re working on your new blog you’ll still post at blogspot, and visitors will comment. Also, the search engines need to pick up your new blog and that takes a while, so no rush at all.

    Please note that when you perform repeated Blogger imports into a WordPress database which stores imported Blogger posts already, new comments to old posts lose their connection to the post and get assigned to the blog’s main page. There’s no official way to move a comment from there to the post it belongs to. So better copy these comments manually, that’s doable with Better Comments Manager, where you can reply from the comments list and edit the author. However, it may be a good idea to do the final import as one of the last steps to prevent you from too many manual tasks like that.

    Unfortunately the WordPress Blogger import does not change links pointing to blogspot URLs in your posts. I’ve parsed the post_content column for these links as well as image locations at blogger.com and created a list of posts to edit. It is possible to automate that further, at least for the links to other posts, but I had to edit many posts due to formatting issues anyway and didn’t link much to my other posts, so I did that manually (respectively will do over time). It makes sense to parse the imported posts for HTML comments and PRE tags which work fine with Blogger but can break the layout under WordPress.

  3. Here are a few ideas what one can do with such a mapping table. To accomplish it you need a plugin that allows the execution of PHP code within the content of posts and pages.

    Looping the wp_blogger_url_maps table you can create for example an index page of all imported blogspot posts and their new locations.

    Or you could write a mapping tool which delivers new URLs and ask your friends to use it to update their posts linking to you.

  4. What you really should do is writing a redirect script to “link” from your old blogspot posts to the new URLs. Make sure that the redirect code is 301, not 302! If you only set the location you get an unwanted 302 redirect:


    @header(”HTTP/1.1 301 Moved Permanently”, TRUE, 301);
    @header(”Location: $guid”);
    exit;

    Say the script is http://sebastians-pamphlets.com/blogspot.php and accepts an input variable src used to locate the new canonical URL. In your blogger template’s post section you can add this link a while before you move, so that search engines become comfortable with the new locations:

    <em>posted by <a href="http://sebastians-pamphlets.com/blogspot.php?src=~
    <$BlogItemPermalinkUrl$>"><$BlogItemAuthorNickname$></a> @ <a href="<$BlogItemPermalinkUrl$>" title="permanent link"><$BlogItemDateTime$> · PERMANENT LINK</a></em>
    (Remove the “~\n” when you copy the code!)

    Another possible issue you might solve with these links is that you can transfer the source bonus in search engine indexes from the old posts to the new URLs. One indicator used by the engines to figure out which one of two identical page contents is the source is an unidirectional link. The major search engines do that silently, Technorati even documents it with “NEW URL !” as the linked post title (of the old location) when you put a textual hint like “moved to” or so on the old pages.

  5. Later on when you actually move you should change the nickname link to your new blog’s root index page, and put the redirect script in the permalink’s href. Then insert a robots meta tag “noindex,follow” in the blogger template and add prominent links to the new URLs to each post.

    Monitor the traffic on blogspot (use any free blog stats package or tools like MBL). When most visitors populate your new blog and the search engines have indexed it completely, you can redirect all blogspot URLs to your new address by inserting a zero refresh redirect meta tag:

    <meta http-equiv=refresh content="0; url=http://sebastians-pamphlets.com/about/sebastianx-blogspot-com/" />

    That will transfer PageRank as well as human visitors to the URL above. It does not route directly to the posts the visitors expected to see when clicking a link on another blog or a SERP (in the HEAD section of the blogger template the variable <$BlogItemPermalinkUrl$> is not yet populated with the permalink so you’ve to use a hard coded URL in the meta refresh directive).

    The redirects from blogspot to my blog come with disadvantages because it’s not possible to map each and every URL to a corresponding page on this site. From a few pages like archives and so on I can link out to my exodus page or the root, but can’t map a post-URL or so. So I’ve not yet decided whether I’ll do the final redirect or not.

    Of course it would transfer the PageRank from my old blog to this site, but it certainly would confuse visitors who click a link to any post on blogspot and land on the exodus page or the main page here. I guess that’s a sure-fire procedure to lose visitors. I tend to leave the ugly blogspot thingy as it is now, plastered with links pointing here. I’d rather miss out on a few folks who read my old stuff at blogspot and don’t click through to this blog, than piss off way more visitors with a zero meta refresh. Also, the old blog’s main page only showed a toolbar PR 4 and I’m not afraid to write that off, especially because the very nice folks linking to me in their blogrolls have changed the URL already, and a few friends have even edited their posts — THANKS!– linking to me.

  6. Redirecting folks consuming my stuff in their feed readers was quite easy. I’ve burned this blog’s feed with Feedburner’s MyBrand (free, you get a feed URL like http://feeds.sebastians-pamphlets.com/SebastiansPamphlets). When I was ready to move my still buggy blog I wrote a farewell Blogger post, waited a day to reach most if not all readers, then I redirected my old blogger feed to feedburner resulting in a nice spike (from zero to 150 subscribers) in my Feedburner stats. In Blogger go to Settings/Feed, enter the new feed’s URL and you’re done. You can do that without burning your feed too, but then you miss out on the stats.

Well, a few days after the move everything runs smoothly and as expected. Google has indexed and ranked 60 pages and still counting, I spotted my very first SERP referrer, and the number of indexed pages from blogspot.com decreases slowly caused by the noindex robots meta tag. The other engines are still crawling, only Yahoo has indexed 3 pages and 100 inbound links so far. StumbleUpon users liked my not that serious canonical SEO definitions and created more buzz than Sphinn so far. I feel lucky.

My to-do list is here and if you’re interested in my scripts drop me a message in the comments.



Share/bookmark this: del.icio.usGooglema.gnoliaMixxNetscaperedditSphinnSquidooStumbleUponYahoo MyWeb
Subscribe to      Entries Entries      Comments Comments      All Comments All Comments
 

15 Comments to "The technical side of moving a blog from Blogger to WordPress"

  1. Andy Beard on 28 August, 2007  #link

    With the old importer all I had to do was retain the same permalink structure.
    Initially I was using a script which parsed the referrer to redirect to the correct page, but after Google added domain mapping that was no longer needed.

    If the sitemap generator doesn’t include all your custom pages they might not get indexed.

  2. Sebastian on 28 August, 2007  #link

    The move was an opportunity to get rid of the timestamps in my URLs, so I’ve set slugs-only as permalink URL structure before I ran the import. My redirect script (and the landing page listing all imported posts) check the referrer too, just in case the query string variable is empty or there is no query string.

    The custom pages are either well linked or desired phase-outs, that’s why I didn’t put them on the sitemap pages. The XML sitemap includes custom pages.

    I’ve just disabled all references to the archives because –SEO wise– that’s useless duplicate content and very few visitors search/navigate by date of posting, provided there is a better organized path to the contents.

    Indexed category pages OTOH trigger nice long tail search terms, duplicating the posts there is definitely not a SEO problem, at least not with Google.

  3. Michael Martinez on 28 August, 2007  #link

    When we moved the SEO Theory blog from Blogger to a dedicated domain (running Wordpress) we left the old Blogger posts in place. All it did was confuse people (and the search engines). I finally deleted all the posts off Blogger and left one up there (without redirection) that said, “This blog has moved. The new URL is….”

    Search referrals and positioning immediately improved over the next couple of weeks.

    The old tricks are still the best tricks.

  4. Sebastian on 28 August, 2007  #link

    Thanks for stopping by Michael. I saw what you did back then and actually thought about it when I finally decided to move. Since I’ve noindex’ed the old blog completely and plastered it with links to the new locations, I hope that my try to perform a somewhat soft move will not result in confusion.

  5. […] (respectively writing off contents on) free hosts I should have known that I was going to run into serious troubles. So do yourself a favor and flee now. Blogger is not meant as a platform for professional blogs. […]

  6. Arafela on 29 August, 2007  #link

    Thanks Sebastian, your posts are really informative. Going bookmark and subscribe to RSS feed ;-)

  7. Sebastian on 29 August, 2007  #link

    Thanks, I’m glad you like my pamphlets. :)

  8. Chris on 30 August, 2007  #link

    If you import Blogger to Wordpress, does your Blogger content still exist at the old site, or is it moved to Wordpress and then deleted from it’s original spot?

  9. Sebastian on 31 August, 2007  #link

    Chris, it just copies the data. The importer doesn’t delete posts or comments in Blogger’s database, but it doesn’t copy all attributes.

    BTW I don’t link out to affiliate links pages, not even nofollow’ed, so please dont drop such URLs in your comments. Thanks.

  10. Rory on 17 September, 2007  #link

    This is a great post I am still sharing it with other people who are asking How and is it a good idea to go wordpress

  11. Sebastian on 17 September, 2007  #link

    Thanks Rory, I’m glad you consider it helpful.

  12. I just wish someone would help me do it before I get too many more inbound links to my site. Past 3-4 weeks or so and already like 26… want to move before then but honestly lack the patience and tech expertise.

    Maybe recommend a good, reputable outsource and how much one could roughly expect to pay. I’ve about 70-80 posts I think.

    Sam

  13. Sebastian on 28 November, 2007  #link

    Sam, I’d like to help you but I’m booked out, actually I’m somewhat swamped and close to produce angry clients. Try to register a domain and get paid hosting, download and install WordPress, choose a template and then import the posts and comments from Blogger. This way you don’t get a SEO’ed blog, but something to experiment with. If you want me to assist (setting up the redirects, converting the links and all that) please drop me a line. BTW a script automating this process is doable, and there’s a market, but I can’t invest the time short-dated.

  14. […] Tech tips on how to move from Blogger to Wordpress […]

  15. Vingold on 15 January, 2008  #link

    I made a move like this recently for some throwaway blogs I had and now I’m wishing I had read this post first.

    This whole website is excellent. It will take me days even weeks to digest all of the good stuff on here. It is encyclopedic knowledge of webmastering at its best. Very well done.

    Oh, and there are at least 8 things you do with this blog that I’ll probably steal and use elsewhere. Hope you don’t mind ;-)

Leave a reply


[If you don't do the math, or the answer is wrong, you'd better have saved your comment before hitting submit. Here is why.]

Be nice and feel free to link out when a link adds value to your comment. More in my comment policy.