cd C:\DevKit
ruby dk.rb init
notepad config.yml
末尾添加新的一行 - C:\Ruby200-x64,保存文件并退出
ruby dk.rb review
ruby dk.rb install
gem install jekyll
easy_install Pygments
gem install bundler
gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
gem sources -l
gem install rails
或用 Bundler 的 Gem 源代码镜像命令
$ bundle config mirror.https://rubygems.org https://gems.ruby-china.org
//这样你不用改你的 Gemfile 的 source
source 'https://rubygems.org/'
gem 'rails', '4.1.0'
jekyll new myblog&&cd myblog&&jekyll serve --watch
浏览:localhost:4000$ mkdir blog && cd blog && git init&& git checkout --orphan gh-pages
创建没有父节点的分支gh-pages。因为github规定,只有该分支中的页面,才会生成网页文件
根目录/_config.yml
baseurl: /blog
根目录/_layouts目录(存放模板文件,Jekyll使用Liquid模板语言)
mkdir _layouts&&cd _layouts&& touch default.html
default.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>\{\{ page.title \}\}</title>
</head>
<body>
\{\{ content \}\}
</body>
</html>
mkdir _posts&&cd _posts&&touch 2017-05-20-博客搭建.md
填入以下内容
---
layout: default
title: 你好,世界
---
<h2>\{\{ page.title \}\}</h2>
<p>我的第一篇文章</p>
<p>\{\{ page.date | date_to_string \}\}</p>
三根短划线”—“:元数据,标记开始和结束
“layout:default”,表示该文章的模板使用_layouts目录下的default.html文件
“title: 你好,世界”,表示该文章的标题是”你好,世界”
根目录/index.html
---
layout: default
title: 我的Blog
---
<h2>\{\{ page.title \}\}</h2>
<p>最新文章</p>
<ul>
\{\% for post in site.posts \%\}
<li>\{\{ post.date | date_to_string \}\} <a href="/blog">\{\{ post.title \}\}</a></li>
\{\% endfor \%\}
</ul>
输出内容两层大括号,单纯命令一层大括号。/blog
是_config.yml中设置的baseurl变量
加入本地git库:
git add .&& git commit -m "first post"
前往github创建一个名为blog库,将本地内容推送到github
git remote add origin https://github.com/401718154/blog.git
git push origin gh-pages
访问hhttps://401718154.github.io/blog/
git clone git://github.com/jarrekk/Jalpc.git
注释掉: #gems:
# - jekyll-assets
@echo off
start cmd /k "jekyll serve --watch"
start http://localhost:4000/blog/
注册友言账户,点击获取代码
<!-- UY BEGIN -->
<div id="uyan_frame"></div>
<script type="text/javascript" src="http://v2.uyan.cc/code/uyan.js?uid=2143694"></script>
<!-- UY END -->
修改Jekyll
uyan:
uid: 2143694
<div id="uyan_frame"></div>
<script>
(function() {
var d = document, s = d.createElement('script');
s.src = '//v2.uyan.cc/code/uyan.js?uid=2143694';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
.gitignore
添加 _site/*
$ git init
$ git add .
$ git commit -m "init blog"
$ git remote add origin xxxxxxx(拷贝github的地址)xxxxxxx.git
$ git push origin master
http://www.pchou.info/open-source/2014/04/03/git-gitolite-hook.html