WP to org-mode + hyde + disqus

Hello World!

My first post at my new home. Obviously, it was going to be about the move. You knew it, didn't you? ;)

Well, I got some space on the web, along with a few friends. Thanks to my org-mode fanboyism, I now use it to maintain my homepage. I've successfully completed import of my Wordpress posts and comments. :)

I now use

  • Emacs and Org-mode 1 to write my posts.
  • org-hyde.el 2 to publish html in a hyde parse-able format.
  • hyde 3 to convert the html pages into a blog.
  • org-publish to publish other pages in my home page.
  • git 4 and a bash script for publishing.
  • Disqus 5 for the comment system.

Yes, I know it sounds rather complicated. :) But, now that I have it set up, it's not all that difficult to make a post. It's just a matter of one git commit and push. I need to fine-tune the shell script a bit, though.

How I moved

The move definitely wasn't trivial. I guess, I could've started afresh but, what fun would that have been? ;)

This roughly how I did things โ€“ in the order that I did them.

Choosing hyde

I looked at a handful of options to maintain a blog, using org-mode โ€” blorg, org-jekyll, blorgit, ikiwiki. After some assessment, I decided upon org-jekyll and jekyll. But then, I accidentally stumbled upon hyde.

I decided to go with hyde instead of jekyll 6 since

  1. It's in Python. I didn't want to start figuring out Ruby, now.
  2. It uses Django templates 7. And Django is something, I wish to learn. I've started with that. :)

Clean up org-jekyll to work with hyde.

I then "ported" org-jekyll.el into org-hyde.el.

  • removed stuff like categories and languages, that I was not going to use.
  • Added some code w.r.t timestamps, from org2blog, to it, so that my older org2blog posts could be easily ported.

Clean up older org2blog posts

org2blog can post either buffers or subtrees. I had posts in both formats. I converted all of them into subtrees of one tree, using some Python.

Import older posts

This was the most painful posts. Importing all the old posts from Wordpress. org-mode really needs a XHTML/XML importer!

I did all sorts of crazy stuff to get this done.

  • used pandoc to convert html to markdown
  • wrote some throw away regex code to convert markdown to org-mode.
  • wrote more regex code to convert html to org-mode.
  • hacked up a lot of stuff and finally got all the posts into org format! :)

A workflow for publishing

Set up git along with some bash code, to have a mechanism to minimize the effort in making a blog post. All this is still a lot of work, compared to the ease with which I used to use org2blog. That's partly due to ssh restrictions in my hostel.

CSS clean-up

I'm using the same CSS for org-mode published files and hyde published files. I had to clean up my hyde templates and the CSS to make both of them look similar.

My first tryst with CSS hasn't been all that bad. :)

Installing disqus and importing comments

Using disqus was one thing, I wasn't sure I wanted to do. I would've loved it if comments could be managed with org-mode too. ;) 8

Anyway, I finally decided to go with it, and I'm quite happy with it. :)

I loved the ease with which comments could be imported.

  1. Import Wordpress comments using the export xml file.
  2. Generate a CSV file containing the URL map โ€“ mapping the newer urls to the older ones.
  3. Upload the CSV file and tada!

Conclusion

I got to learn quite a few things, during all of this. I also have some bits of code, that I can share with you, in case you are interested. Leave a comment, if you wish. :)

I'm just hoping to reduce the additional steps required in publishing to ensure it doesn't add to my already erratic blogging habits.

Footnotes:

1

Org-mode - Homepage

2

Org-hyde is a port of org-jekyll.el

3

Hyde - Github

4

Git - Homepage

5

Disqus - Homepage

6

Github - Jekyll

7

Documentation - Django Templates

8

I feel it is capable of doing that. It's just my incapability that prevented me from trying it out.

Show comments