(update: Migrated the code to GitHub and implemented minor improvements.)
It has finally happened: this blog is migrated away from Drupal to Blogger. My reason to move towards Blogger (and thus not away from Drupal) is very simple: No need to patch/update the application.
An important thing for me is that I wanted to keep all my blogposts, timestamps and comments. Unfortunately it looks like most people move away from Blogger towards Drupal and the web is full of code and information to export your data from Blogger in XML and then import it into Drupal.
But information how to upload everything into Blogger was nihil.
So I wrote a php script to do the export while keeping:
- posts
- comments
- tags / categories
- publishing date
- It seems to work only for Drupal 6, not 7.
- Comments are (partially) anonymized because of a security feature of Blogger
- URLs are not customizable, so you will create dead links
- Images are not changed or imported. So manual work is still necessary
Save the file and import it again in Blogger. It usually takes some time, but in the end you get the message that everything is imported correctly.
The code to do this is located here: https://github.com/cvandeplas/inet_scripts/blob/master/drupal_to_blogger.php .
A version for Drupal 7 has been written by Nico Schlömer is located here: https://github.com/nschloe/drupal2blogger
Your code was a GODSEND! Thank you sir, two quick notes
ReplyDeleteFirst: if you don't use the db_prefix setting (my drupal install was a very old first installed, then upgraded many times site - so mine has always been $db_prefix = '';) then you need to alter the code above just removing drupal_ from all the SQL statements above.
Second: and this is completely a NOOB mistake by me, but it might save others some pain - after it runs, remember to "view source" to actually get the right code you need put in your import xml file - I went nuts trying to figure out what was wrong with code and why PHP PRINT was "stripping out" the HTML - only to have a facepalm moment when I realized it was the damn browser :(
Third: don't forget to change the Author section in the middle away from Christopher, you can find your info in the export he instructs you to create earlier.
Christophe Vandeplas
http://www.blogger.com/profile/01574685218200894861
christophe@vandeplas.com
Sadly wish there was an easier way to get pictures over too, but what your code did already saved me hours of work getting my site moved! +1 for the post!
This was wonderful!
ReplyDeleteA lot of the posts were added like five times, but easy to delete in Blogger…
Thanks a lot!
This comment has been removed by the author.
ReplyDeleteUsed your code. Worked well. Thanks.
ReplyDeleteOne small change I made: added the comment author name (but not email, of course) at the end of the comment text in brackets, so a reader can at least have some indication who the now anonymous comment was from.
$body [posted by: $author]
@T: very good idea, I updated the post
ReplyDeleteI have done the migration successfully today, and your code worked very well, so thanks a lot for sharing!
ReplyDeleteAlso a thank you to David, your tips for sure saved me from much pain :-)
Anne: Thanks for the feedback.
ReplyDeleteI also integrated some feedback from David and uploaded everything to my github account.
To make everything easier I've set the Content Type to text/xml and to a downloadable file. So instead of having to show the source you simply get a file called drupal_to_blogger_export.xml
Another satisfied user. Thank you Christophe.
ReplyDeleteNeeded to change localhost under "...should probably NOT change..."
hey, thanks for the work, this really is the only 1 search leading from google to "migration from drupal to blogger" :D
ReplyDeleteis there a way to specify only one user id and the damn blog node type? (I have a multi-blog with more users posting and a forum, and 1 wants to transfer to Blogger)
This comment has been removed by the author.
ReplyDeleteI think you should make clearer that this is only for Drupal 6.
ReplyDeleteAlright so, I took drupal_to_blogger and modified it for Drupal 7; get it at https://github.com/nschloe/drupal2blogger. It also supports nested comments!
ReplyDeleteGreat ! I updated the post and the github page to add a more clear link to your version.
ReplyDeleteI followed the readme, the error bX-7rv9ue appears when import to blogspot.
ReplyDeleteI used the drupal2blogger
For problems with drupal2blogger you should contact Nico on his page : https://github.com/nschloe/drupal2blogger/issues
DeleteOk I am trying this on an old and very long lived Drupal site on shared hosting. I am running the php via ssh and getting "Cputime limit exceeded: 24", any way to limit the cputime for the script and re-run from where it stops, or maybe spawn of separate instances for each export?
ReplyDeleteOk got that sorted, found that it had a lot of spam comments so I removed the comments export section and it finishes in less than a minute. Now I can't figure out where I am supposed to paste the export from Drupal into the blogger export, I tried just removing my test entry from the to tags and that didn't work.
DeleteI have also tried removing from the first through to the last in the export to no avail, all come back with no posts imported.
ok so on a whim I just tried importing the direct export from Drupal and it seems to be working, just importing posts 5 times, ah well easy to delete.
Delete