需要对Git的基本操作有些了解:
##设置全局用户名和email,作为每次提交的记录 git config --global user.name “name" git config --global user.email “mail.com” ##添加一个仓库 git remote add origin git@….git git push -u origin master ##当提示权限不够时,添加ssh公钥 ##在用户的.ssh目录下找id_rsa.pub等文件,没有的话去生成 ssh-keygen -t rsa -C "[email protected]” ##设置pull的默认地址 git branch --set-upstream-to=origin/master ##设置push的默认地址 git remote add origin git@….git ##配置别名 git config --global alias.xx '' ##临时保存工作区 git stash git stash pop ## 回滚 git reset —hard 版本号 ## 强行回滚远程服务器 git push -f
配置别名后会很方便,如果我有一个这样的别名:
bogon:portfolio zhangao$ git config --global alias.ci commit -m在提交的时候用ci就行了。单个人使用Git,不协同工作的话,还是比较简单的。
pygments: true
{% highlight ruby %} def foo puts 'foo' end {% endhighlight %}ruby替换为 你所使用的语言的短名称即可。
excerpt_separator: ""
<h4>分类列表</h4> <hr> {% for category in site.categories %} <li class="category_list_item"><a href="/showCategory.html?categoryName={{ category | first }}">{{ category | first }}</a> ({{ category | last | size }}) </li> {% endfor %}
var articleList = [{% for post in site.posts %} <span style="white-space:pre"> </span>{"title":"{{post.title}}", "url":"{{site.url}}{{post.url}}", <span style="white-space:pre"> </span> "date":"{{ post.date | date:'%Y-%m-%d' }}", "excerpt": '{{ post.excerpt | strip_html | strip_newlines | truncate:170 }}' {% if post.categories != empty %} , "categories":[{% for category in post.categories %}"{{category}}"{% if forloop.last == false %},{% endif %}{% endfor %}]{% endif %}} {% if forloop.last == false %},{% endif %}{% endfor %}];我在这里判断了文章有没有分类,如果没有分类的话,就不添加到这个JSON里了,另外说下post.excerpt:
<a href="javascript:void(window.location.href=encodeURI('/showCategory.html?categoryName={{ category | first }}'))">{{ category | first }}</a>取的时候用decodeURI函数去取。
paginate: 10 paginate_path: "page:num"paginate表示开启分页并设置每页的数量;paginate_path是指定分页时Jekyll寻找HTML文件的路径,比如这里设置为page:num,那么Jekyll在分页时,第一页还是你的博客的index.html,第二页就是/page2/index.html,第三页就是/page3/index.html。如果指定的path不存在会自动往上级目录找,直到根目录的index.html,或者这个参数没有设置的话默认值就是page:num。
{% for post in paginator.posts %} <a href="{{ post.url }}">{{ post.title }}</a> {% endfor %}
{% if paginator.total_pages > 1 %} {% if paginator.previous_page %} <a href="{{ paginator.previous_page_path }}">上一页</a> {% endif %} {% if paginator.next_page %} <a href="{{ paginator.next_page_path }}">下一页</a> {% endif %} {% endif %}
{% for page in (1..paginator.total_pages) %} {% if page == 1 %} <a href="/index.html">{{ page }}</a> {% else %} <a href="{{ site.paginate_path | replace: ':num',page }}">{{ page }}</a> {% endif %} {% endfor %}因为第一页是index.html,不是page1,所以要特殊处理一下。这样一个简单的分页就完成了。