Jekyll是一个使用Ruby编写的静态站点生成工具,使用Liquid模板渲染引擎,支持Markdown和Textile标记语言,并且可以为所有以 .html、.markdown、.textile扩展名结尾的文件使用YAML配置,内置语法高亮功能。而Github的Pages服务可以为每个Github主机上的仓库提供静态页面服务,并且Pages服务支持Jekyll。因为Github Pages有两种Pages,分别是用户页面和项目页面,所以我们可以使用用户页面来创建自己的Blog。


首先,创建你的 Blog 仓库 username(请确保跟你的账号名相同).github.com:

  $ mkdir username.github.com
  $ cd username.github.com

到git settings里开启github page



  $ mkdir myblog
  $ cd myblog
  $ git init
  $ git remote add git@github.com:username/username.github.io.git
  $ git pull origin master
  $ rm -rf *

新建一个 jekyll 项目,像下面这样:

  $ cd ..
  $ jekyll new myblog
  $ cd myblog


$ vi _config.xml
# Site settings
title: Github Page 
email: huangshiyang@outlook.com
description: > # this means to ignore newlines until "baseurl:"
 Write an awesome description for your new site here. You can edit this
 line in _config.yml. It will appear in your document head meta (for
 Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "http://username.github.io.git" # the base hostname & protocol for your site
twitter_username: jekyllrb
github_username: jekyll
# Build settings
markdown: kramdown


  $ git add . 
  $ git commit -a -m 'init commit.'
  $ git push origin master

现在你打开 username.github.com 就可以看到刚才新建的页面了,就是这么简单。当然也可以为你的Blog仓库绑定独立域名,具体做法就是:

  1. 在你的仓库中新建内容为 www.youdomain.com 的 CNAME 文件;
  2. 在你的域名管理页或者是DNS解析的地方,增加一个记录,记录类别为CNAME(Alias)类型.



  |-- _config.yml
  |-- _includes
  |-- _layouts
  |   |-- default.html
  |   `-- post.html
  |-- _plugins
  |-- _posts
  |   |-- yyyy-mm-dd-title.markdown
  |   `-- yyyy-mm-dd-title.markdown
  |-- _site
  `-- index.html




该目录存放可以与layouts和posts混合、匹配并重用的文件。Liquid标签{% include file.ext %}可以用于嵌入文件_includes/file.ext。






该目录下存放的可以说成是你的“动态内容”。这些文件的格式很重要,它们的文件命名一定要遵循 yyyy-mm-dd-title.html|markdown|textile 规则。每一个帖子的固定链接URL可以作弹性的调整,但帖子的发布日期和转换所使用的标记语言会根据且仅根据文件名中的相应部分来识别。



16 thoughts on “使用Jekyll在Github上搭建博客

  1. Link exchange is nothing else but it is just placing the other person’s web site link on your page at suitable place and other person will also do same in support of you.|

  2. I simply want to say I am just newbie to blogs and truly liked you’re website. Most likely I’m planning to bookmark your blog post . You certainly come with great writings. Kudos for sharing with us your web-site.

  3. Thank you so much for providing individuals with remarkably special possiblity to read in detail from this blog. It really is so lovely plus stuffed with fun for me and my office acquaintances to search your website at the least thrice every week to find out the newest stuff you have. And definitely, I’m just actually contented concerning the remarkable principles you serve. Selected 4 facts on this page are surely the most beneficial we have all had.

  4. My husband and i were really contented that Jordan managed to complete his preliminary research through the entire ideas he got from your own web page. It’s not at all simplistic to just find yourself giving for free information and facts which usually some other people might have been making money from. So we figure out we need the blog owner to appreciate for that. All of the illustrations you’ve made, the simple web site menu, the relationships you help to foster – it’s most fabulous, and it’s really leading our son in addition to us feel that the idea is satisfying, and that is incredibly mandatory. Many thanks for everything!

  5. I have to show thanks to the writer just for bailing me out of this type of problem. Because of surfing throughout the internet and coming across opinions which were not productive, I thought my entire life was over. Existing minus the answers to the problems you have resolved all through your main guideline is a crucial case, as well as those that could have adversely affected my entire career if I hadn’t noticed the website. Your own personal natural talent and kindness in dealing with every item was tremendous. I don’t know what I would have done if I had not encountered such a solution like this. I am able to at this point look forward to my future. Thanks so much for the impressive and result oriented help. I will not be reluctant to suggest your web blog to anyone who should get tips on this area.

  6. Thanks a ton for your time and efforts to have decided to put these things together on this blog. Michael and i also very much treasured your insight through your own articles on certain things. I know that you have a number of demands with your timetable and so the fact that you actually took as much time like you did to steer people like us by way of this article is actually highly treasured.

  7. We fully appreciate your website post. You will find dozens of tactics we could put it to really good use with the help of little or no effort with time and financial resources. Thank you really for helping make the post answer many questions we have experienced before now.

  8. Thanks a ton for your time and energy to have had these things together on this web site. Emily and i also very much valued your knowledge through your own articles on certain things. I recognize that you have several demands on your own program hence the fact that you took equally as much time just like you did to help people like us via this article is also highly prized.

  9. hey there and thank you for your information – I have definitely picked up something
    new from right here. I did however expertise some technical
    points using this site, as I experienced to reload the site many times previous to I could get it to load correctly.

    I had been wondering if your web hosting is OK? Not that I am complaining,
    but slow loading instances times will sometimes affect your
    placement in google and could damage your quality score if ads and marketing
    with Adwords. Well I’m adding this RSS to my email and could look out
    for much more of your respective exciting content.
    Ensure that you update this again soon.

Leave a Reply

Your email address will not be published. Required fields are marked *