This is Part 2 of my series on setting up my blog for Orchard CMS. If you have not read Part 1, I suggest you go check it out first as it goes through the setup of the Orchard blog. In this post I will share what I went through to get converted out of Graffiti and to a format that Orchard can import (BlogML).
|Walking Through the Orchard Part 1 – Setting up a Blog|
|Walking Through the Orchard Part 2 – Conversion from Graffiti|
|Walking Through the Orchard Part 3 – BlogML Import|
|Walking Through the Orchard Part 4 – ???|
Where to Start?
A few quick internet searches uncovered a very useful program written by Jon Sagara (who says he converted it from VB to C# from Curt C). I downloaded it, unblocked it, extracted it, then added a few extra lines of code to write statements to the output window so I could watch the conversion as it went. I also changed the pointer to the database for Graffiti, so it could find the file to convert. Pretty easy change to the app.config file:
Next I commented out the call to export to movable type and uncommented the call to export to BlogML (since that is what I use to import into Orchard). The lines of code I flipped are in the RunButton_Click handler in Form1.cs:
Time to Run
Overall it was a success. It took about 3 hours to run for about 630 posts and 3000+ comments, which is why I was glad I added the Console.Writeline statements so I could watch its progress. Total time from download of the program, initial tests and conversion was just under 5 hours. In the end I had a 4.5 MB XML file that I could use to import into Orchard once I was ready.
NOTE: I ran this conversion for another blog which has about 40 posts and it took about 5 minutes. Not sure why the first one took so long … perhaps it was just an anomaly. The latter seems much more realistic. Maybe due to the comments I had … so basically, “your mileage may vary”.
This conversion worked, but there were some things I wish I knew in advance that I did not find out until after I had already exported the content and then imported it into my Orchard instance. At that point, I just cleaned it up and moved on.
So went were those things? Well, the slugs were all exactly the same as the url’s to the posts. I use slugs occasionally for posts like Silverlight TV notices, so I knew I had to go fix these.
Next, the categories in Graffiti were exported as tags. If I looked closer at the BlogML I would have noticed this, but I didn’t. So this was a casualty of my conversion that I was willing to live with and fix later.
The comments were all wrapped with a <p> and </p> html tags. Easy fix once I got it into the destination database, but still annoying. Here is the TSQL I used to fix it.
Caution: I am not responsible for what you do with this TSQL! So use at your own risk . In fact, I included a rollback transaction in here so you can try it and see the results before you commit it.
There may be other issues waiting for me, but this is what I found in the first few days.
So in summary, here are the issues I ran into:
- Slugs got hosed. Wish I knew in advanced, as I would have fixed the code. Hopefully my pain here is your gain.
- Tags got hosed. Again, hindsight is 20/20. I have a SQL command I am working on to get these back, but its not bothering me that much.
- Comments don’t have names next to them. The user name (for the blog) was brought over for the comments when in fact I wanted the name the person entered in the comment. I don’t require folks to log in, so my user names ere blank. In hindsight I would have brought over the Author name. You can fix this in the export code above.
The next part of this series will cover the import process into Orchard. And I am realizing that there will certainly be more parts to this series after that too as there is much more I have learned. Overall I am very happy with my decision to move to Orchard. The pains I have run into are almost entirely due to getting off of Graffiti.
I hope this helps! Please share your experiences too.