当前位置: 首页 > 工具软件 > pages-gem > 使用案例 >

在GitHub上搭建GitHub Pages博客-- Jekyll

阎淮晨
2023-12-01

大约2年前,在GitHub上用Jekyll搭建了自己的博客:https://zhang0peter.com/。然后写了几篇博客后就没动过了。
然后2019年我开始在CSDN上写博客,GitHub上的博客更没动过了。
现在寒假期间想起了自己的GitHub博客,于是打算重新搭建。

先安装ruby,windows的下载链接:RubyInstaller for Windows
ubuntu可以直接安装:

apt install ruby-full

然后配置国内镜像,用ruby安装jekyll等包:

-> # gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
https://gems.ruby-china.com/ added to sources
https://rubygems.org/ removed from sources
> gem install activesupport jekyll bundler github-pages liquid-c
Installing ri documentation for github-pages-203
Done installing documentation for ... github-pages after 43 seconds
83 gems installed

然后就可以进行配置了:

-> % git clone https://github.com/zhang0peter/zhang0peter.github.io.git
-> % cd zhang0peter.github.io 
-> # jekyll serve
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Configuration file: /home/ubuntu/zhang0peter.github.io/_config.yml
            Source: /home/ubuntu/zhang0peter.github.io
       Destination: /home/ubuntu/zhang0peter.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
   GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
       Jekyll Feed: Generating feed for posts
                    done in 18.255 seconds.
 Auto-regeneration: enabled for '/home/ubuntu/zhang0peter.github.io'
    Server address: http://127.0.0.1:4000
  Server running... press ctrl-c to stop.

服务启动成功


参考文档:
关于 GitHub Pages 和 Jekyll - GitHub 帮助
GitHub Pages - Jekyll • 简单静态博客网站生成器


具体过程参考:barryclark/jekyll-now: Build a Jekyll blog in minutes, without touching the command line.
搭建一个免费的,无限流量的Blog----github Pages和Jekyll入门 - 阮一峰的网络日志


这里说一个怎么更新库吧:

bundle install
bundle update
 类似资料: