赞
踩
Github.io上可以方便地打造自己的博客网站,相对于CSDN等社区网站来说既没有广告又能凸显个人调性。
建站步骤非常简单
在个人github上建一个repository,名字必须是username.github.io
推送一个静态html上去
# clone the prj
git clone https://github.com/username/username.github.io
# Hello World
cd username.github.io
echo “Hello World” > index.html
# Push it
git add –all
git commit -m “Initial commit”
git push -u origin master
https://username.github.io.
就可以访问网页了。Github.io只能静态网页浏览服务,无法通过运行后端代码提供动态功能,所以只能用于博客之类的简单网站,但是我们依然有优化空间,通过优化静态的html页面让网站更漂亮。
github推荐Jekyll这个静态网站构建工具:
Transform your plain text into static websites and blogs.
– Jekyll的Slogan
Jekyll官网的安装需求
- Ruby version 2.4.0 or above, including all development headers (ruby version can be checked by running ruby -v)
- RubyGems (which you can check by running gem -v)
- GCC and Make (in case your system doesn’t have them installed, which you can check by running gcc -v,g++ -v and make -v in your system’s
command line interface)
我使用呢win10配置了Ruby环境并进行了Jekyll安装:
参考:https://jekyllrb.com/docs/installation/windows/
Ruby官网 下载Ruby+Devkit 2.6.5-1
gem install jekyll bundler
$ bundle exec jekyll new mysite --force
$ cd mysite
$ bundle exec jekyll serve
Configuration file: C:/Users/~~/documents/github/~~/mysite/_config.yml
Source: C:/Users/~~/documents/github/~~/mysite
Destination: C:/Users/~~/documents/github/~~/mysite/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
done in 2.626 seconds.
Auto-regeneration: enabled for 'C:/Users/~~/documents/github/~~/mysite'
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
建站成功,通过http://localhost:4000/
可以看到以下页面
建站后的目录结构简单说明一下:
更多详细内容 参考 https://github.com/jekyll/minima
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。