Joseph Bloggs

Online home of Joseph Talbot: Little Briton

Main menu

Porting blog posts and comments into Drupal

26 June 2011 - 8:12pm -- Joseph

I'm trying to work out how to port the content of an existing blog (this one) into Drupal. The problem I have is that this blog isn't currently running on an established blogging platform (Blogger, Wordpress, Moveable type, etc...) that someone may have written an import module for. Rather this blog is run on a MySQL and php monstrosity I hacked together myself some years ago.

I guess the good news is that I understand the structure of the existing data and have complete control over it.

The bad news is that I'm not sure how how to do it.

What I'd like to do is take all my existing blog posts which basically consist of a title, body and published date (there is author information as well, but this isn't vital) and put them into Drupal article nodes (I'm using Drupal 7). Additionally (and this is where it may get a bit more tricky) I'd like to bring the comments in as well, such that comments (body, author, submitted data) gets put into Drupal article comments.

As I see it, there are three ways to go about this:

export all my data in a format that can be imported into Drupal, e.g. as an RSS feed which can be consumed by the Drupal Feeds module.
This seems do-able but I can't see how to set comments fields as targets in a feed importer.
Find some way for Drupal to connect to my MYSQL database and grab to data directly.
Tinker around in SQL to grab the data from my database and stick into the Drupal database.
I favour option one, but that's only because it's the only one I have any experience with...

Does anyone have any bright ideas how I might go about this?

If so, please leave a comment and I promise to port the comment over to Drupal, if I can...


Maybe a combo of options 1 and 3?

Use feeds to add the blog post data in, and add the original entry_id's as an extra field in the 'article' nodes to give a unique id for entries between the two db's, then do some SQL Wrangling outside of Drupal to push in the comment data directly into the appropriate table(s)?

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.