美文网首页一起学起来
Mac下基于Github和jekyll搭建博客

Mac下基于Github和jekyll搭建博客

作者: Cathyhi | 来源:发表于2016-02-17 12:10 被阅读1787次

    Gollum是github的使用的一个基于markdown的 wiki系统,界面清爽,轻量级系统。

    系统环境:

    MacBook Pro 10.11.2
    Homebrew 0.9.5
    ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
    

    安装步骤

    1. 安装依赖项icu4c
      sudo brew install icu4c
    2. 安装依赖项 charlock_holmes
      sudo gem install charlock_holmes -- --with-icu-dir=/usr/local/opt/icu4c
    3. 安装依赖项 nokogiri
      sudo gem install nokogiri -v '1.6.6.2' -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib
    4. 安装gollum
      sudo gem install gollum

    使用说明

    1. 创建Wiki
      建立一个名字为”wiki”的目录使用git进行管理
      mkdir wiki; cd wiki;git init;

    2. 执行gollum后,输入localhost:4567,就进入Wiki的编辑页面了,可以在web上直接编辑,或者在终端提交markdown文件。

    初次进入页面 Wiki首页

    常见问题:

    1. 安装过程中如果有类似如下的连接报错
    Gem::RemoteFetcher::FetchError: Errno::ECONNRESET: Connection reset by peer - connect(2) for "rubygems.global.ssl.fastly.net" port 443 (https://rubygems.org/gems/rouge-1.10.1.gem)
    

    则需要先执行如下命令修改为淘宝源:

    sudo gem sources --remove https://rubygems.org/
    sudo gem sources -a https://ruby.taobao.org/
    sudo gem sources -l
    

    再执行sudo gem install gollum即可。

    1. 安装后,执行gollum时有如下报错
      == Someone is already performing on port 4567!
      说明4567的端口被占用,解决方法是:
      使用命令 lsof -i tcp:port(port替换成端口号如4567)查看端口被占用情况,kill PID。

    2. 本地新增文件后,刷新Wiki没有同步显示。
      原因是Gollum内部是使用git作为版本库管理的,所有本地文件的改动是不会在Gollum生效的,必须提交才能刷新页面。

    3. 如何给页面设置目录,Header,Footer,Siderbar等?
      可以参见Wiki 页面调优--官方给出的8个页面设置方法,如设置标题(page title)、设置header、footer、siderbar,设置目录(tables of contetents)等。

    • Setting page titles
    • Using subpages
    • Page sanitization (security note)
    • Gollum tag reference
    • Gollum code block reference
    • Gollum macro reference
    • Gollum diagram reference
    • Integrating mathematics

    例如,gollum的页面标题默认是展示其路径的,若要隐藏路径,显示第一个大标题,只需要在启动gollum时增加--h1-title参数,如
    xiaoting:mywiki ting$ gollum --h1-title
    再例如,想增加Header,Footer,Siderbar,可以在创建的wiki文件夹中增加_Header.md,_Footer.md,_Siderbar.md文件,在文件中加入想显示的内容,git更新后即可显示。

    还有的大家就参看Wiki 页面调优吧,很简单的英文,描述的也很清楚。

    相关文章

      网友评论

        本文标题:Mac下基于Github和jekyll搭建博客

        本文链接:https://www.haomeiwen.com/subject/zhcmkttx.html