(1 week Post) Jekyll Create GitHub Pages

Posted:   January 07, 2021

Status:   Completed

Tags :   jekyll Github-Pages

Categories :   jekyll

Were equations, pictures or diagrams not properly rendered, please refresh the page. If the problem persists, you can contact me.

题外话

相识于微时,离别于成年。


jekyll install

1. gem & bundler

更换清华源

https://mirrors.tuna.tsinghua.edu.cn/help/rubygems/ or https://gems.ruby-china.com/

2. Installation

https://jekyllrb.com/docs/installation/

# 注意只安装bundler,而非jekyll bundler,因为后续和gem "github-pages"依赖的Jekyll版本不兼容
gem install bundler 

3. Step by Step Tutorial

https://jekyllrb.com/docs/step-by-step/01-setup/

4. Gemfile

GitHub Pages 依赖项版本,请查阅 Dependency versions

卸载所有原有gem安装包

for i in `gem list --no-versions`; do gem uninstall -aIx $i; done # 卸载所有gem安装包

修改Gemfile

https://bundler.io/gemfile.html

bundle init # 创建一个新的Gemfile
# frozen_string_literal: true

source "https://mirrors.tuna.tsinghua.edu.cn/rubygems"

# git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# 
# gem "rails"
# gem "jekyll"
# gem 'jekyll-sitemap'
# gem 'jekyll-paginate'
# gem 'jekyll-seo-tag'
gem "github-pages", group: :jekyll_plugins

5. 安装Gemfile中依赖项

bundle install # 安装依赖项
bundle update github-pages # 更新依赖项

6. 常用命令

bundle exec jekyll build
bundle exec jekyll serve

参考

https://docs.github.com/cn/github/working-with-github-pages/getting-started-with-github-pages

Comments


Be the first one to comment on this page!
You can use extended GitHub flavored markdown in your comment. Commenting FAQs & Guidelines