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
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:
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.
I ran the same code in
irb
(Interactive Ruby)It gave me some detailed error that I need to install
hpricot
. So, I installed hpricot.But still the ruby command prompt was giving me error. So, I ran the importer code through
irb
. As explained by WayneThat 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 removedoptions: {}
line from the meta content of the posts.Thanks to Jonathan and Wayne for there support in Ruby chatroom.