使用github/gitcafe和jekyll搭建自己的博客
参考资料
扫盲帖
github官方使用jekyll文档,虽然我没有看懂:p
主要参考了God-Mode的写作环境搭建
Jekyll tempelate
###其他参考资料###
http://blog.devtang.com/blog/2014/06/02/use-gitcafe-to-host-blog/
http://blog.devtang.com/blog/2012/02/10/setup-blog-based-on-github/
gitcafe pages HOWTO
补充1: 安装ruby-devel包
在openSUSE13.2安装gem install jekyll
提示找不到头文件/usr/include/ruby-2.1.0/ruby/ruby.h
,安装ruby-devel和ruby2.1-devel后解决:
zypper in ruby-devel ruby2.1-devel
gem install jekyll
之后,我的包列表:
> gem list
*** LOCAL GEMS ***
bigdecimal (1.2.4)
colorator (0.1)
fast_gettext (0.8.1)
ffi (1.9.10)
gem2rpm (0.10.1)
io-console (0.4.3)
jekyll (3.0.1)
jekyll-sass-converter (1.3.0)
jekyll-watch (1.3.0)
json (1.8.1)
kramdown (1.9.0)
liquid (3.0.6)
listen (3.0.5)
mercenary (0.3.5)
minitest (4.7.5)
psych (2.0.5)
rake (10.1.0)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
rdoc (4.1.0)
rouge (1.10.1)
ruby (0.1.0)
ruby-dbus (0.11.0)
rubygems-update (2.5.1)
safe_yaml (1.0.4)
sass (3.4.20)
test-unit (2.1.7.0)
补充2: 注册google analysis帐号
的README.md提到要修改`_layouts / default.html`中 google analytics的标识`_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);`。反复尝试搜索内容,搜索"_setAccount ua"可以搜索到:
[google analysis说明和注册链接](https://developer.chrome.com/extensions/tut_analytics)
补充3: 微信
-----------
### 如何转发到朋友圈
用微信发布包含网址的文字信息,然后用微信自带的浏览器打开这个网址,选择分享到朋友圈即可。
[参考](http://jingyan.baidu.com/article/0eb457e5017fda03f1a90539.html)
### 朋友圈缩略图
缩略图会使用第一张尺寸大约300x300的图片.
[参考](http://www.zhihu.com/question/21668601), 通过`site.url`(原文是`site.baseurl`不知道为什么我的baseurl不行)得到路径:
``
从[这里](http://vrepin.org/vr/CopyrightedMonumentsFinland/), [源码](https://raw.githubusercontent.com/vitalyrepin/vrepinblog/master/_posts/2015-09-18-CopyrightedMonumentsFinland.md)找到了设置图片的方法.
补充4: 评论
-----------
我的评论使用disqus,参考:
<https://help.disqus.com/customer/portal/articles/472138-jekyll-installation-instructions>
<http://hobodave.com/2010/01/08/moving-to-jekyll-disqus/>
补充5:搜索引擎
----------------
参考[zhenyu的博客](http://zyzhang.github.io/blog/2012/09/03/blog-with-github-pages-and-jekyll-seo/)在google和baidu注册。
baidu站长验证有三种方式:网站根目录文件验证,主页html标签验证和cname验证。根目录文件不知道怎么加,cname验证貌似需要dns解析服务器帮忙解析域名。看到自己代码里面有index.html,想先试下这个,但是index.html明显不是html格式文档啊啊啊,咋办?
回忆下之前看jekyll的资料,jekyll使用[YAML Front Matter](http://jekyllrb.com/docs/frontmatter/)作为文件头。其中网页的模板由layout指定。例如我的index.html里面"layout: page",会去找_layouts/page.html, _layout/page.html又指定layout是default,这个default.html是html文档。所以我的html标签验证内容应该插入到default.html里面。
```
```
我用的是js的自动提交,在_layout/post.html插入即可。
折腾之后发现原来作者定义了sitemap,也上传了bjzhang.github.io/sitemap.xml。sitemap.xml原始文件如下
```
---
layout: nil
---
http://aarch64.me/2019/11/trip-confusion-and-growing-up/
2019-11-11T00:00:00+00:00
weekly
1.0
http://aarch64.me/2019/02/try-shortcut-and-others-tools-thinking-as-programmer/
2019-02-05T00:00:00+00:00
weekly
1.0
http://aarch64.me/2019/01/The-Power-of-Full-Engatement-and-weekly-summary/
2019-01-26T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/12/A-cool-fish/
2018-12-14T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/11/ipfs-libp2p-monthly-progress/
2018-11-30T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/11/venom-in-everyone-s-body/
2018-11-07T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/11/lifeweek-201837-born-as-girls/
2018-11-03T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/10/meituan-position-performance-kernel-and-docker/
2018-10-20T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/10/thoughts-after-watching-Hichki/
2018-10-16T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/10/career-rethinking/
2018-10-14T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/10/Understanding-Children-with-Drawing/
2018-10-02T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/10/Filecoin-FAQs/
2018-10-02T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/09/Filecoin-IPFS-meet-up-Beijing/
2018-09-16T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/09/go-shadowsocks/
2018-09-01T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/08/Filecoin-Q1-and-Q2-Update/
2018-08-31T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/08/blockchain-and-data-storage-20180819-20180825/
2018-08-28T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/08/blockchain-and-data-storage-20180812-20180818/
2018-08-20T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/08/blockchain-and-data-storage-20180805-20180812/
2018-08-13T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/08/blockchain-and-data-storage-20180729-20180804/
2018-08-05T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/06/wechat-donation/
2018-06-23T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/06/recent-kernel-update_02/
2018-06-23T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/06/education-what-you-believe-you-have-seen/
2018-06-18T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/06/ACM-turing-lecture-2018/
2018-06-09T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/06/GIAC-blockchain-and-bitcoin-01/
2018-06-01T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/05/recent-kernel-update_01-overview/
2018-05-31T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/05/video-in-bud17/
2018-05-30T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/05/my-slide-archieve/
2018-05-30T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/05/appliance-summary-03-KIWI-from_SUSE/
2018-05-13T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/05/blockchain-and-bitcoin-by-huobi-coo/
2018-05-12T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/05/appliance-summary-02-KIWI-from-SUSE/
2018-05-10T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/05/automatic-deploy-Linux/
2018-05-01T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/04/Education-parents-meeting/
2018-04-26T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/04/China-developed-CPU/
2018-04-23T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/03/food/
2018-03-29T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/03/linaro-hkg18-notes/
2018-03-22T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/03/Montessori-parent-teacher-conference/
2018-03-16T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/03/k8s-learning-and-try-it/
2018-03-12T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/03/cooking-life/
2018-03-10T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/03/kernel-tests/
2018-03-09T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/03/appliance-summary/
2018-03-06T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/03/golang-based-game-helper/
2018-03-03T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/02/linode-cli/
2018-02-24T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/02/how-to-transfer-file-through-putty/
2018-02-23T00:00:00+00:00
weekly
1.0
http://aarch64.me/2018/02/Large-File-Support-In-Linux/
2018-02-11T00:00:00+00:00
weekly
1.0
http://aarch64.me/2017/08/Looking_for_myself/
2017-08-01T00:00:00+00:00
weekly
1.0
http://aarch64.me/2017/07/LC3-notes/
2017-07-06T00:00:00+00:00
weekly
1.0
http://aarch64.me/2017/06/move-on/
2017-06-29T00:00:00+00:00
weekly
1.0
http://aarch64.me/2017/06/LC3-China-Topics-Huawei/
2017-06-18T00:00:00+00:00
weekly
1.0
http://aarch64.me/2017/06/growup-youngman/
2017-06-14T00:00:00+00:00
weekly
1.0
http://aarch64.me/2017/06/thinking-about-education/
2017-06-09T00:00:00+00:00
weekly
1.0
http://aarch64.me/2017/06/Implementing-Contiguous-page-hint-in-userspace/
2017-06-02T00:00:00+00:00
weekly
1.0
http://aarch64.me/2017/05/Shadowsocks-in-Linux-HOWTO/
2017-05-26T00:00:00+00:00
weekly
1.0
http://aarch64.me/2017/01/free-phone-and-baseband-property/
2017-01-19T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/12/arm64-architecture-documents-collection/
2016-12-30T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/12/how-to-find-out-a-definition-of-a-syscall-or-libc-function/
2016-12-08T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/11/suse-release-12-sp2-including-aarch64-support/
2016-11-09T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/10/writev-behavior-change-a-little-bit/
2016-10-28T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/10/openat-and-open-a-close-lookat-in-kernel-and-glibc/
2016-10-18T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/10/toggl-a-universe-timer/
2016-10-12T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/09/try-slack/
2016-09-06T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/08/split-stack-support-for-arm64/
2016-08-19T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/05/how-to-use-shadowsocks-in-PC-and-chromebook/
2016-05-07T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/02/how-to-print-optimized-out-value-in-gdb/
2016-02-28T00:00:00+00:00
weekly
1.0
http://aarch64.me/2016/01/how-to-run-opensuse-aarch64-on-qemu/
2016-01-16T00:00:00+00:00
weekly
1.0
http://aarch64.me/2015/12/hackweek-hikey-and-sensor-kit/
2015-12-31T00:00:00+00:00
weekly
1.0
http://aarch64.me/2015/12/github-pages-and-jekyll-notes/
2015-12-23T00:00:00+00:00
weekly
1.0
```
生成的结果文件如下:
```
http://bjzhang.github.io/2015/12/hackweek-hikey-and-sensor-kit/
2015-12-31T00:00:00+00:00
weekly
1.0
http://bjzhang.github.io/2015/12/github-pages-and-jekyll-notes/
2015-12-23T00:00:00+00:00
weekly
1.0
```
2016年1月4日更新
---------------
补充6:dns解析
--------------
之前有很多[博客](http://beiyuu.com/github-pages/)说github dns解析需要添加一条A(ALIAS)记录,但是这个方法已经是[github禁止的方法](https://github.com/blog/1917-github-pages-legacy-ip-deprecation)。正确的方法是添加一条CNAME记录,指向自己的域名。貌似对于dnspod.cn来说需要加"xxx.github.io."。完整方法在[这里](https://help.github.com/articles/setting-up-a-custom-domain-with-github-pages/)。
gitcafe绑定自定义域名可以在”自定义域名“里面设置,同样需要在dns服务商添加CNAME,详见<https://gitcafe.com/GitCafe/Help/wiki/Pages-%E7%9B%B8%E5%85%B3%E5%B8%AE%E5%8A%A9#wiki>
可以用dig判断dns解析是否正确,国内网络:
```
> dig aarch64.me +nostats +nocomments +nocmd
; <<>> DiG 9.9.6-P1 <<>> aarch64.me +nostats +nocomments +nocmd
;; global options: +cmd
;aarch64.me. IN A
aarch64.me. 545 IN CNAME gitcafe.io.
gitcafe.io. 545 IN A 119.81.161.100
```
之前百度解析sitemap.xml总是提示403,dns分流后,百度也可以自动正确得到sitemap了:)