Import wordpress posts in jekyll

I already have a blog maintained by wordpress. Now, I am planning to move my blog posts to jekyll.

I already forked jekyll basic blog template from jekyllnow

Read More

and then I tried to import all my blog posts from wordpress to jekyll using WordPress to jekyll exporter plugin as explained in this smashing magazine article.

To export from WordPress, I’d highly recommend Ben Balter’s one-click WordPress to Jekyll Exporter plugin.

This didn’t work for me.

So, my second attempt was to export the wordpress posts in an xml file as explained in the same smashing magazine article.

The other option is to export all content in the “Tools” menu of the WordPress dashboard, and then importing it with Jekyll’s importer.

So, I first exported only my posts from wordpress to xml.

WordPress Admin -> Tools -> Export -> checked posts -> Download xml file

and placed that xml file in my project folder, which is with directory name kamlekar.github.io.

and then in Ruby’s command prompt, I cd to my project folder and run the following code as shown in the below image:

enter image description here

As you can see, I am getting the following error:

-e:1: syntax error, unexpected ‘=’, expecting tASSOC

The command I wrote is

ruby -rubygems -e 'require "jekyll-import"; JekyllImport::Importers::WordpressDotCom.run({ "source" => "wpexport.xml"} )

I am not sure why this error is coming. I already installed gem install github-pages and gem install jekyll-import.

Here is a dummy xml file to reproduce the issue.


I am on Windows 8 with Ruby 1.9.2 installed.

Related posts

1 comment

  1. I ran the same code in irb (Interactive Ruby)

    $ irb
    

    It gave me some detailed error that I need to install hpricot. So, I installed hpricot.

    irb > exit
    $ cd <project_folder>
    $ gem install hpricot
    

    But still the ruby command prompt was giving me error. So, I ran the importer code through irb. As explained by Wayne

    $ irb
    irb>  require "jekyll-import"; JekyllImport::Importers::WordpressDotCom.run({ "source" => "wpexport.xml"} )
    

    That worked!!

    But still in my imported posts, there were characters like }); at the top-left of page. Which I removed by visiting each post file in _posts/and removed options: {} line from the meta content of the posts.

    Thanks to Jonathan and Wayne for there support in Ruby chatroom.

Comments are closed.