最近闲来无事,捣鼓了一下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. 传说中的WCF(9):流与文件传输

    在使用Socket/TCP来传输文件,弄起来不仅会有些复杂,而且较经典的“粘包”问题有时候会让人火冒七丈.如果你不喜欢用Socket来传文件,不妨试试WCF,WCF的流模式传输还是相当强大和相当实用的 ...

  2. UVA 10497 - Sweet Child Makes Trouble 高精度DP

    Children are always sweet but they can sometimes make you feel bitter. In this problem, you will see ...

  3. ARM 汇编指令

    ARM汇编程序特点: l         所有运算处理都是发生通用寄存器(一般是R0~R14)的之中.所有存储器空间(如C语言变量的本质就是一个存储器空间上的几个BYTE).的值的处理,都是要传送到通 ...

  4. SPRING IN ACTION 第4版笔记-第十章Hitting the database with spring and jdbc-003-四种方式获取DataSource

    一.概述 1.Spring offers several options for configuring data-source beans in your Spring application, i ...

  5. Qt通过UDP传图片,实现自定义分包和组包

    一.包头结构体 //包头 struct PackageHeader { //包头大小(sizeof(PackageHeader)) unsigned int uTransPackageHdrSize; ...

  6. Head First HTML5 Programming笔记--chapter1 认识HTML5

    升级到HTML5 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 //EN" "http://www.w3.org/TR/ ...

  7. 284. Peeking Iterator

    题目: Given an Iterator class interface with methods: next() and hasNext(), design and implement a Pee ...

  8. 271. Encode and Decode Strings

    题目: Design an algorithm to encode a list of strings to a string. The encoded string is then sent ove ...

  9. Android 使用意图传递数据

    使用意图传递数据之通用方式. 测试应用:当前页面点击button传递数据到一个新的页面显示在textview中. 首先在,mainActivity.xml文件中加入一个button按钮 <But ...

  10. java读写中文文件

    在用Java程序进行读写含中文的txt文件时,经常会出现读出或写入的内容会出现乱码.原因其实很简单,就是系统的编码和程序的编码采用了不同的编码格式.通常,假如自己不修改的话,windows自身采用的编 ...