We’ve been playing with pppBlog for a while now, mainly because it’s lack of a database requirement means there’s one less point of failure. Nothing is more annoying that your blog dying just because someone has run a dummass query on the database. No, really.
It’s got a few rough edges (mainly buggy themes that seem to be a throwback to an earlier version) but other than that it’s great. There’s nothing a little php and css knowledge can’t sort.
One challenge we had though was a desire to move a lot of posts from WordPress to pppBlog. To do that, I wrote a little perl script which takes an rss feed from WordPress and convert the posts into pppBlog format – ie, individual textfiles stores in a year/month directory format.
First off, here’s the code. Got that? OK.
Next we need to generate the .rss feed to work will. In the WordPress blog, we set the rss feed to output full posts, and send the latest 2,000 articles. That should catch everything. Now we grabbed the .rss feed using wget to save it as a file.
We needed to edit the rss a little to make it play nicely. WP outputs in rss2 format, and perl’s XML::RSS module (at least, the version I’m using) didn’t like the content:encoded element of the feed. So I cheated by using vim to rename all of the content:encoded sections to just content (:s/content:encoded/content/g) then remove the linebreaks in the content element itself (:g/content>/,/\/content/j). I could have fixed the rss in the perl code – or worked around it – but as it’s a one-shot import, this was the quickest solution.
Now that’s done, I just ran
And the blogposts became pppblogposts I copied over the 06/ directory into the content/ folder of pppblog then created a new dummy post from within pppblog itself. This forced the cache to refresh, picking up the “new” posts along the way. Job done, all the posts are in place.