Importing Wordpress messages into jekyll
I already have a blog powered by wordpress. I am now planning to move my blog posts to jekyll.
I have already developed a basic jekyll blog template from jekyllnow
and then i tried to import all my blog posts from wordpress to jekyll using wordpress for jekyll exportorter as described in this devastating magazine article .
To export from WordPress, I'd highly recommend Ben Balters to click WordPress one click for Jekyll Exporter.
It didn't work for me.
So my second attempt was to export Wordpress messages to XML file as described in the same log article.
Another option is to export all content from the Tools menu in the WordPress dashboard and then import it using the Jekylls importer .
So, I first exported only my posts from wordpress to xml.
Wordpress Admin -> Tools -> Export -> checked posts -> Download xml file
and put this xml file in my project folder with directory name kamlekar.github.io
.
and then on the Ruby command line, I connected to my project folder and ran the following code as shown in the image below:
As you can see, I am getting the following error:
-e: 1: syntax error, unexpected '=' awaiting tASSOC
The command I wrote is
ruby -rubygems -e 'require "jekyll-import"; JekyllImport::Importers::WordpressDotCom.run({ "source" => "wpexport.xml"} )
I'm not sure why this error is coming. I have already installed gem install github-pages
and gem install jekyll-import
.
Below is a dummy xml file to reproduce the issue.
I am on Windows 8 with Ruby 1.9.2 installed.
source to share
I ran the same code in irb
(Interactive Ruby)
$ irb
This 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 line was giving me an error. So, I ran the importer code via irb
. As Wayne explained
$ irb
irb> require "jekyll-import"; JekyllImport::Importers::WordpressDotCom.run({ "source" => "wpexport.xml"} )
It worked!
But still my imported posts had type characters });
in the upper left corner of the page. Which I removed by visiting each post file in _posts/
and removing the line options: {}
from the post meta content.
source to share