把WordPress迁移到Jekyll

2015-07-24 veryyoung 更多博文 » 博客 » GitHub »

原文链接 http://veryyoung.me/blog/2015/07/24/move-wordpress-to-jekyll.html
注:以下为加速网络访问所做的原文缓存,经过重新格式化,可能存在格式方面的问题,或偶有遗漏信息,请以原文为准。


把WordPress迁移到Jekyll

早就无法忍受WordPress蜗牛般的反应速度了,抽时间狠狠心给它迁移到Gitpages了,骄傲的使用了Jekyll。可以使用github管理文章,免费无流量限制,最重要的是可以用Markdown哦!

下面说一下迁移步骤

1.导出WordPress文章 本来想使用jekyll-exporter,但是部署到SAE,run,报错

Warning: dir(saestor://wordpress/uploads) [function.dir]: failed to open dir: "SaeStorageWrapper::dir_opendir" call failed in wp-content/plugins/jekyll-exporter/jekyll-exporter.php on line 390

Fatal error: Call to a member function read() on a non-object in wp-content/plugins/jekyll-exporter/jekyll-exporter.php on line 391

再也不想用所谓的Paas了,一点自由都木有!

WordPress自带导出功能,可以把文章导出成xml文件。

然后再借助wpXml2Jekyll这款神器把xml导出成md文件,导出的文章需要进行微调,比如文章标题,代码格式之类的。

2.安装Jekyll JekyllBootstrap官网有个jekyll-quick-start,对着上面走一遍,就Ok了,中间涉及到github的一些操作,ruby的安装之类的...

在我大天朝网络状况不太好,会

λ gem install jekyll

ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) Errno::ECONNABORTED: An established connection was aborted by the software in your host machine. - SSL_connect (https://api.rubygems.org/quick/Marshal.4.8/jekyll-2.5.3.gemspec.rz)

最好把ruby的源换成taobao的

λ gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources
D:\Ruby22-x64\dev-tool
λ gem sources -a https://ruby.taobao.org/
https://ruby.taobao.org/ added to sources

3.放入博文 将第一步得到的md放入到_posts文件夹下,git push

4.绑定域名 参考https://help.github.com/articles/setting-up-a-custom-domain-with-github-pages/,具体方法是在repo的根目录下面,新建一个名为CNAME的文本文件,里面写入你要绑定的域名,比如veryyoung.me,然后在域名商添加A记录,指向Gitpages的IP


这就完了,接下来换主题改界面之类的随便折腾去吧!!