Hosted on your server(on-premise)
1. install it on ubuntu
sudo apt-get install ruby-full build-essential zlib1g-dev
export GEM_HOME="$HOME/gems" #consider add the following two sentence into bashrc file
export PATH="$HOME/gems/bin:$PATH"
gem install jekyll bundler
Reference: jekyllrb.com/docs/
2. new a basic page
jekyll new www
cd ~/www
jekyll serve --host=0.0.0.0 #alternatively, you can also set nginx root dir to _site folder.
Reference: www.digitalocean.com/community/t…
3. update with your own content
在_post文件夹里面增加自己的markdown文件,注意文件名与内容开始的标签
Reference: www.ayush.nz/2021/08/int…
4. change theme
- add
gem "minimal-mistakes-jekyll"into Gemfile - run
bundleto update - set
theme: minial-mistakes-jekyllin_config.yml
Hosted on Github
- Github有两种模式:第一种repo直接放生成的html文件(md文件也支持),github的action会把这些自动放到githubpage上。第二种放原始的md文件与
_config.yml,github的action,会把生成的artifacts(html)放在githubpage上。 - 不管哪种模式都要在setting中设置gitpage
- 如果repo的名字为
username.github.io,则为web的默认主页,不需要加repo名字。 - github action都是自动创建的,不需要手动写workflow的文件
方式一: 直接html文件
- 创建要给public的repo
- 里面新建一个index.html文件
- repo设置里page设置正确的目录
- 访问 username.github.io/reponame
Reference: pages.github.com/
方式二:使用Jekyll生成(默认主题)
on local ubuntu
jekyll new --skip-bundle .
#replace gem "jekyll" with specific version in doc
bundle install
git add .
git commit -m "comments"
- repo的名字要是username.github.io 否则会部分加载不出来,有待调研
bundle add webrickbefore bundle install # this is needed and workaroud for ruby >3.0 in local preview- Gemfile 定义了需要安装的依赖,Gemfile.lock显示了经过
bundle命令后实际安装的依赖。- 直接基于模板创建或者fork repo是一个很快捷的方式
- 不需要像文档里创建doc目录,直接根目录创建即可
- Reference: docs.github.com/en/pages/se…