最近闲来无事,捣鼓了一下Git以及Github,尝试了一下基于Jekyll搭建个人博客的方法,现在把整个过程进行一个总结(部分内容转自互联网):

<img src="http://upload.chinaz.com/2014/0616/1402906891370.jpg" alt="静态博客 Jekyll入门 网站建设" width="607" height="250" />

一、Jekyll简介

Jekyll是一个免费的blog生成工具,可以根据网页源码生成静态文件。用户先在本地编写Jekyll网站源码,然后托管到Github。优点:(1)免费,没有流量限制;(2)可以更加专注于文章的撰写,减少对格式、排版的分心。缺点:(1)有一定技术门槛;(2)托管到Github上的网站内容,很容易被其他人clone到。总的来说,依然是搭建个人博客一个比较好的选择。

二、搭建第一个简易个人博客

1、创建本地博客存储文件夹:

$ mkdir jekyll

$ cd jekyll

$ git init

2、创建没有父节点的gh-pages

$ git checkout --orphan gh-pages

3、创建设置文件夹:

$ cd ..返回根目录

$ gedit _config.ym输入一下内容,并保存:

baseurl: /jekyll_demo

4、创建模板文件:

$ mkdir _layouts

$ cd _layouts[/cpp]

$ gedit defalut.html输入以下内容,并保存:

<ul>
<li style="font-weight: inherit; font-style: inherit;">{{ page.title }}</li>
<li style="font-weight: inherit; font-style: inherit;">{{ content }}</li>
</ul>

5、写第一篇文章

$ cd ..回到根目录

$ mkdir _posts

$ gedit 2014-10-10-helloworld.html输入一下内容,并保存:
<ul>
<li style="font-weight: inherit; font-style: inherit;">---</li>
<li style="font-weight: inherit; font-style: inherit;">layout: default</li>
<li style="font-weight: inherit; font-style: inherit;">title: 你好,世界</li>
<li style="font-weight: inherit; font-style: inherit;">---</li>
<li style="font-weight: inherit; font-style: inherit;">
<h2 style="font-style: inherit;">{{ page.title }}</h2>
</li>
<li style="font-weight: inherit; font-style: inherit;">
<p style="font-weight: inherit; font-style: inherit; color: #000000;">我的第一篇文章</p>
</li>
<li style="font-weight: inherit; font-style: inherit;">
<p style="font-weight: inherit; font-style: inherit; color: #000000;">{{ page.date | date_to_string }}</p>
</li>
</ul>

6、创建首页

到根目录

$ gedit index.html输入以下内容,并保存:
<ul style="color: #000000;">
<li style="font-weight: inherit; font-style: inherit;">---</li>
<li style="font-weight: inherit; font-style: inherit;">layout: default</li>
<li style="font-weight: inherit; font-style: inherit;">title: 我的Blog</li>
<li style="font-weight: inherit; font-style: inherit;">---</li>
<li style="font-weight: inherit; font-style: inherit;">
<h2 style="font-style: inherit;">{{ page.title }}</h2>
</li>
<li style="font-weight: inherit; font-style: inherit;">
<p style="font-weight: inherit; font-style: inherit; color: #000000;">最新文章</p>
</li>
<li style="font-weight: inherit; font-style: inherit;"></li>
<li style="font-weight: inherit; font-style: inherit;">{% for post in site.posts %}</li>
<li style="font-weight: inherit; font-style: inherit;">{{ post.date | date_to_string }} <a style="font-weight: inherit; font-style: inherit; color: #1e3e74;" href="http://www.chinaz.com/web/2014/0616/%7B%7B%20site.baseurl%20%7D%7D%7B%7B%20post.url%20%7D%7D">{{ post.title }}</a></li>
<li style="font-weight: inherit; font-style: inherit;">{% endfor %}</li>
</ul>

7、发布内容

7.1、把所有内容加入本地git库

$ git add .

$ git commit -m 'first post'

7.2、创建github仓库

登录github网站新建repository,例如名为jekyll

$ git remote add origin https://github.com/USERNAME/jekyll.git

$ git push origin gh-pages

7.3访问博客效果

<img class="alignnone size-medium wp-image-121" src="http://riden001.com/wp-content/uploads/2014/10/kk-300x150.png" alt="kk" width="300" height="150" />

http://USERNAME.github.com/jekyll可以看到博客效果。

使用Jekyll搭建博客的更多相关文章

  1. 在github上搭建博客(使用Jekyll)

    简单说,只需要三步,就可以在 Github 搭建起一个博客: 在 Github 上建一个名为 xxx.github.io 的库: 把看中了的 Jekyll 模板 clone 到本地: 把这个模板 pu ...

  2. github page+jekyll搭博客初体验

    div.oembedall-githubrepos { border: 1px solid #DDD; list-style-type: none; margin: 0 0 10px; padding ...

  3. 手把手教从零开始在GitHub上使用Hexo搭建博客教程(一)-附GitHub注册及配置

    前言 有朋友问了我关于博客系统搭建相关的问题,由于是做开发相关的工作,我给他推荐的是使用github的gh-pages服务搭建个人博客. 推荐理由: 免费:github提供gh-pages服务是免费的 ...

  4. 利用gitHub搭建博客

    ##1.gitHub Page的的使用我觉得这边博文写的很清楚,方法.步骤.优缺点以及实例,所以就借用一下啦^_^ [搭建一个免费的,无限流量的Blog](http://www.ruanyifeng. ...

  5. 可能是最详细的 Hexo + GitHub Pages 搭建博客的教程

    前言:博主目前大三,Web 前端爱好者.写博客的好处,不是为了写而写,而是一个记录思想的过程.不要考虑它能带给你什么,而是你自己从中收获了什么. 最近刚好有空,于是就参照网上的各种教程,搭建了一个博客 ...

  6. 基于Hexo搭建博客并部署到Github Pages

    基于Hexo搭建博客并部署到Github Pages 之前在简书上写东西,觉得自己还是太浮躁.本来打算用Flask自己写一个,以为是微框架就比较简单,naive.HTML.CSS.JS等都要学啊,我几 ...

  7. 利用Octopress在Github上搭建博客及后续问题总汇

    首先贴一下我的新博客地址: http://findingsea.github.io 用Octopress在GitHub上搭建博客已经不是什么新鲜事了,网上的教程也多了去了,大题的方法什么都差不多,这篇 ...

  8. 手把手教 GitHub + Hexo 搭建博客

    前言 在很久以前,博主就想着要有自主的博客专栏或者网站.经历了博客园这个需要所谓的编辑审核,一直比较困惑,这些编辑是什么出身,怎么知道技术博客的价值性. 接下来找到了开源中国,这个可以自由发言的地方. ...

  9. Hexo+NexT(零):最全Hexo+Next搭建博客教程

    快速.简洁且高效的博客框架 有位大神说,喜欢写博客的人的人,折腾博客会经历三个阶段.找到一个免费空间,搭建一个博客,很欣喜,很有成就感,此为一阶段:受限免费空间各种限制,自己买空间和域名,实现对博客的 ...

随机推荐

  1. Codeforces Round #263 (Div. 2) A B C

    题目链接 A. Appleman and Easy Task time limit per test:2 secondsmemory limit per test:256 megabytesinput ...

  2. 二、Android NDK编程预备之Java jni入门Hello World

    转自:  http://www.eoeandroid.com/forum.php?mod=viewthread&tid=264543&fromuid=588695 昨天已经简要介绍了J ...

  3. poj 3255(次短路)

    题目链接:http://poj.org/bbs?problem_id=3255 思路:分别以源点1和终点N为源点,两次SPFA求得dist1[i](1到各点的最短距离)以及dist2[i](各点到N的 ...

  4. Yarn上的几个问题整理

    原文链接   http://xiguada.org/yarn_some_question/ ‎   1. NodeManager是如何Kill掉Container的呢? 答,在DefaultConta ...

  5. Linux inotify功能及实现原理

    http://www.cnblogs.com/jiejnan/archive/2012/05/18/2507476.html 简介: 当需要对 Linux®文件系统进行高效率.细粒度.异步地监控时,可 ...

  6. 让ie6也支持max-width,和max-height实现图片等比例缩放

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. Sails 关闭自动路由 Automatic Routes 功能。

    Sails 关闭自动路由 Automatic Routes 功能. Sails 中的路由两种:Custom Routes 和 Automatic Routes,自定义路由和自动路由.详见文档: Sai ...

  8. js金额转换大写

    从tenpay找到的一段将金额小写转换成大写的js代码: var DX = function (num) { var strOutput = ""; var strUnit = ' ...

  9. poj 动态规划题目列表及总结

    此文转载别人,希望自己能够做完这些题目! 1.POJ动态规划题目列表 容易:1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 11 ...

  10. [转载] 推荐的C++书籍以及阅读顺序

    2014-06-17 转载自 oiramario 的文章 推荐的C++书籍以及阅读顺序 当读者有一定c/c++基础 推荐的阅读顺序: level 1 从<<essential c++> ...