Widget to Migrate from Blogspot to Self-Hosted WordPress

  • Unknown's avatar

    I’ve been looking for a simple way to redirect my Blogger posts to my self-hosted WordPress site, but none of the plugins or code I found worked. After 3 days of futzing I came up with the following solution. Place this code after your <Blogger> tag and switch the appropriate identification.

    <b:widget id=’Redirector’ locked=’true’ title=’Blog Posts’ type=’Blog’>
    <b:includable id=’main’>
    <b:if cond=’data:blog.pageType == “item”‘>
    <b:loop values=’data:posts’ var=’post’>
    <div id=’redirectorTitle’ style=’visibility:hidden’><data:post.title/>
    </div>
    <script type=’text/javascript>
    
    var url= ‘<$BlogItemPermalinkUrl$>’;;
    var myNewurl = url.replace(”myblog.blogspot”, “www.myblog”);
    var testurl =’http://www.myblog.com/2008/12/blog-has-moved.html’;
    
    if (myNewurl == testurl)
    {document.location.href = “http://www.myblog.com”;}
    else{
    document.location.href = myNewurl;}
    </script>
    </b:loop>
    </b:if>
    </b:includable>
    </b:widget>

    Notes:

    * This assumes you are moving from myblog.blogspot.com to http://www.myblog.com
    * You must have structured your wordpress permalinks to match your blogger permalinks for this to work, which is easy enough to do in your wordpress dashboard.
    * The testurl variable will vary for you. The problem comes about because on your homepage the $BlogItemPermalinkUrl$ pulls the top post from the page rather than thinking you want the main page. Therefore, determine what the new version of that url will be and put it in here for your homepage to correctly route.

  • Unknown's avatar

    your in the wrong forum, this is for wordpress.COM blogs not wordpress.ORG blogs

  • Unknown's avatar

    Since you are going self-hosted with wordpress, you will need to head over to http://wordpress.ORG/support/ . This is the wordpress.COM free hosting service and we use a different version of the software here that works differently. What you list above is javascript and it will not work here at wordpress.COM.

  • The topic ‘Widget to Migrate from Blogspot to Self-Hosted WordPress’ is closed to new replies.