在jekyll中导入wordpress帖子 [英] Import wordpress posts in jekyll

查看:83
本文介绍了在jekyll中导入wordpress帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有一个由wordpress维护的博客.现在,我打算将我的博客文章移至jekyll.

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

我已经从 jekyllnow

,然后我尝试使用将Wordpress的所有博客文章从wordpress导入jekyll jekyll exporter 插件,如该粉碎杂志文章.

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.

要从WordPress导出,我强烈推荐Ben Balter的一键式WordPress到Jekyll Exporter插件.

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

这对我不起作用.

因此,我的第二次尝试是将WordPress帖子导出到xml文件中,如同一篇杂志杂志中所解释的那样.

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

另一个选择是导出WordPress仪表板的工具"菜单中的所有内容,然后使用 Jekyll的进口商.

因此,我首先仅将我的帖子从wordpress导出到xml.

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

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

并将该xml文件放置在我的项目文件夹中,该文件夹的目录名为kamlekar.github.io.

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

然后在Ruby的命令提示符下,我进入我的项目文件夹并运行以下代码,如下图所示:

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:语法错误,意外的'=',期望tASSOC

-e:1: syntax error, unexpected '=', expecting tASSOC

我写的命令是

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

我不确定为什么会出现此错误.我已经安装了gem install github-pagesgem install jekyll-import.

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

这是一个虚拟xml文件来重现该问题.

Here is a dummy xml file to reproduce the issue.

我在装有Ruby 1.9.2的Windows 8上.

I am on Windows 8 with Ruby 1.9.2 installed.

推荐答案

我在irb(交互式Ruby )

$ irb

它给了我一些我需要安装hpricot的详细错误.因此,我安装了hpricot.

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

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

但是ruby命令提示符仍然给我错误.因此,我通过irb运行了导入程序代码.正如韦恩(Wayne)解释的

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"} )

那行得通!

但仍然在我导入的帖子中,页面左上角有类似});的字符.我通过访问_posts/中的每个帖子文件将其删除,并从帖子的元内容中删除了options: {}行.

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.

感谢 Jonathan Ruby聊天室中提供了支持.

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

这篇关于在jekyll中导入wordpress帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆