SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
像 hackers 一样写博客

hustcalm@Open-CAS
2013-06-23
写 Blog 的三个阶段
●

●

●

第一阶段,刚接触 Blog ,觉得很新鲜,试着选择一个免费
空间来写。(新浪博客, CSDN ,博客园)
第二阶段,发现免费空间限制太多,就自己购买域名和空
间,搭建独立博客。( Wordpress , VPS )
第三阶段,觉得独立博客的管理太麻烦,最好在保留控制权
的前提下,让别人来管,自己只负责写文章。( Octopress,
Github pages )
Github Pages
●

Free Hosting

●

Page Generation with Themes

●

Manual Pages and Jekyll

●

github Pages 可以被认为是用户编写的、托管在 github
上的静态网页
Jekyll
●

Jekyll (发音 /'dʒiːk əl/ , " 杰克尔 " )是一个静态站点
生成器,它会根据网页源码生成静态文件。它提供了模
板、变量、插件等功能,所以实际上可以用来编写整个
网站。

●

●

参考链接:
像黑客一样写博客— Jekyll 入门

http://www.soimort.org/posts/101/
●
Octopress
●

●

A blogging framework built on top of Jekyll for hackers
Octopress is a framework designed by Brandon Mathis for
Jekyll, the blog aware static site generator powering Github
Pages. To start blogging with Jekyll, you have to write your
own HTML templates, CSS, Javascripts and set up your
configuration. But with Octopress All of that is already taken
care of. Simply clone or fork Octopress, install dependencies
and the theme, and you’re set.
Octopress 优点
●

使用静态页面;

●

不使用数据库;

●

使用 markdown 标记语言编写文章;

●

●

可以与 git 紧密集成,方便地进行博客的版本管
理;
与 Github Pages 集成,不需要单独的 web

hosting
●
Octopress 缺点
●

●

生成的是静态网页,添加动态功能必须使用外
部服务,比如评论功能就只能用 disqus 。
不适合大型网站,因为没有用到数据库,每运
行一次都必须遍历全部的文本文件,网站越
大,生成时间越长
Am I qualified?
●

使用 octopress 和 github 来管理 blog ,需要:

●

懂一点点 ruby(jekyll)

●

使用 github

●

基本的 git 命令

●

基本的 Markdown 使用

●

基本的 Web 前端知识
Setup The Environment
●

Ruby

●

Octopress

●

Github
Ruby
●

使用 rbenv 或者 rvm (推荐使用 rbenv )

●

https://github.com/sstephenson/rbenv

●

https://github.com/sstephenson/ruby-build

●

●

sudo apt-get install build-essential git-core
zlib1g-dev libssl-dev libreadline-dev
rbenv install 1.9.3-p194
Octopress
●

git clone git://github.com/imathis/octopress.git octopress

●

cd octopress

●

rbenv version

●

gem install bundler # 安装 ruby 的 bundler

# 检查 ruby 的版本是否 >=1.9.2

rbenv rehash
command

# If you use rbenv, rehash to be able to run the bundle

●

bundle install

# 安装依赖的组件

●

rake install

# 安装默认的 Octopress 主题

●

●

●

Refer to:

●

http://octopress.org/docs/setup/
Github
●

在 github 上创建一个仓库,仓库格式

yourname.github.io
●

例如你的 GitHub 帐号是 geekboygo 就将
Repository 命名为 geekboygo.github.io ,
完成后会得到一组 GitHub Pages URL

http://yourname.github.io/
●

Refer to:
https://help.github.com/articles/creating-pa
ges-with-the-automatic-generator
Bring It Together
●

`rake setup_github_pages`
填写 git@github.com

:geekboygo/geekboygo.github.io.git
●

`rake generate`

●

`rake deploy`

●

等待几分钟后, github 上会收到一封
信:“ [geekboygo.github.io] Page build successful” ,第
一次发布后等比较久,之后每次都会直接更新
master 和 source 分支
●

●

Octopress 会把代码放在 source 目录下,把生成的
网站放在 _deploy 目录下。并自动将 _deploy 目录
作为 github page 的 master 分支,将包含 source
在内的部分作为 github page 的 source 分支
将 source 加入 git

`git add .`
`git commit -m 'initial source commit'`
`git push origin source`
更新 Octopress
●

●

●

●

git pull octopress master
Octopress

# Get the latest

bundle install
updated

# Keep gems

rake update_source
template's source

# update the

rake update_style
template's style

# update the
发表文章并部署
●

rake new_post[" 新文章名称 "]

●

rake preview

●

rake generate

●

rake deploy

●
●

rake gen_deploy
绑定域名
●

申请个人域名 (GoDaddy, name.com)

●

●

cd source

●

touch CNAME

●

Echo “your_domainname” > CNAME

●

●

In order to serve the Pages, your DNS needs to point at our server.
If you are serving a top-level domain like example.com, you should
have an A record pointing to 204.232.175.78. If you are using a
subdomain like www.example.com, you should have a CNAME
record pointing to [your-username].github.io
Octopress 配置
●

_config.yml

●

●

octopress 增加侧边栏(
http://hustcalm.me/blog/categories/octopres
s/
)
参考链接 - git & github
●

●

git- 简易指南(
http://rogerdudler.github.io/git-guide/index.zh.html)
如何高效利用 GitHub (

http://www.yangzhiping.com/tech/github.html)
●

Github Pages 极简教程(
http://yanping.me/cn/blog/2012/03/18/github-pages-st
ep-by-step/
)

●
参考链接 - Jekyll
●

像黑客一样写博客—— Jekyll 入门( http://www.soimort.org/posts/101/)

●

搭建一个免费的,无限流量的 Blog----github Pages 和 Jekyll 入门(

http://www.ruanyifeng.com/blog/2012/08/blogging_with_jekyll.html)
●

●

Jekyll 建站之旅(
http://calefy.org/2012/03/03/my-process-of-building-jekyll-blog.html)
利用 Jekyll 搭建个人博客(

http://www.mceiba.com/develop/jekyll-introduction.html)
参考链接 - Octopress
●

像 hackers 一样写博客(

http://clark1231.iteye.com/blog/1506553)
●

Blog = GitHub + Octopress (
http://mrzhang.me/blog/blog-equals-github-plusoctopress.html
)

●

使用 Octopress + Github 管理 blog (

http://ishalou.com/blog/2012/10/15/how-to-use-o
ctopress/
)
●
参考链接 - Markdown
●

●

●

Markdown 写作浅谈(
http://www.yangzhiping.com/tech/r-markdown-knitr.html )
Markdown 写作进阶: Pandoc 入门浅谈(
http://www.yangzhiping.com/tech/pandoc.html )
理想的写作环境: Git+Github+Markdown+Jekyll (

http://www.yangzhiping.com/tech/writing-space.html )
●

献给写作者的 Markdown 新手指南( http://jianshu.io/p/q81RER)

●

黑魔法利器 pandoc ( http://yanping.me/cn/blog/2012/03/13/pandoc/ )

●

Markdown : Syntax ( http://markdown.tw/)

●

R 语言忍者秘笈( https://github.com/yihui/r-ninja )
Octopress 进阶
●

为已经存在的 github Octopress 配置本地环境(

http://www.360doc.com/content/12/0216/16/10167
83_187128091.shtml
)
●

服务器端 Octopress 搭建及移动方案(

http://lucifr.com/2011/12/21/octopress-on-server-a
nd-portable-scheme/
)
●

Use Jenkins to Auto Build Jekyll and Octopress (
http://b.imf.cc/blog/2013/01/01/use-jenkins-to-auto-b
uild-jekyll-and-octopress/
)
像 hackers 一样写博客

Q&A
像 hackers 一样写博客

Thank You!

Weitere ähnliche Inhalte

Andere mochten auch

Point cloud mesh-investigation_report-lihang
Point cloud mesh-investigation_report-lihangPoint cloud mesh-investigation_report-lihang
Point cloud mesh-investigation_report-lihangLihang Li
 
Ideation Urban Playground
Ideation Urban PlaygroundIdeation Urban Playground
Ideation Urban PlaygroundJonathan McEwan
 
Social Media Marketing
Social Media MarketingSocial Media Marketing
Social Media MarketingKristen Duncan
 
Notas de Prensa de Movilforum Brasil 2011
Notas de Prensa de Movilforum Brasil 2011Notas de Prensa de Movilforum Brasil 2011
Notas de Prensa de Movilforum Brasil 2011Asesores Locales
 
2013新人见面会-中科院开源软件协会介绍-hustcalm
2013新人见面会-中科院开源软件协会介绍-hustcalm2013新人见面会-中科院开源软件协会介绍-hustcalm
2013新人见面会-中科院开源软件协会介绍-hustcalmLihang Li
 

Andere mochten auch (6)

Point cloud mesh-investigation_report-lihang
Point cloud mesh-investigation_report-lihangPoint cloud mesh-investigation_report-lihang
Point cloud mesh-investigation_report-lihang
 
Ideation Urban Playground
Ideation Urban PlaygroundIdeation Urban Playground
Ideation Urban Playground
 
Social Media Marketing
Social Media MarketingSocial Media Marketing
Social Media Marketing
 
Estaciones
EstacionesEstaciones
Estaciones
 
Notas de Prensa de Movilforum Brasil 2011
Notas de Prensa de Movilforum Brasil 2011Notas de Prensa de Movilforum Brasil 2011
Notas de Prensa de Movilforum Brasil 2011
 
2013新人见面会-中科院开源软件协会介绍-hustcalm
2013新人见面会-中科院开源软件协会介绍-hustcalm2013新人见面会-中科院开源软件协会介绍-hustcalm
2013新人见面会-中科院开源软件协会介绍-hustcalm
 

Ähnlich wie 像Hackers一样写博客-hustcalm

Github简介及实用入门
Github简介及实用入门Github简介及实用入门
Github简介及实用入门Rongxing Liu
 
Git 使用介绍
Git 使用介绍Git 使用介绍
Git 使用介绍medcl
 
前端也能變全端
前端也能變全端前端也能變全端
前端也能變全端ericpi Bi
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshellNelson Tai
 
First meetingwithgit
First meetingwithgitFirst meetingwithgit
First meetingwithgitRhythm Sun
 
版本控制 使用Git & git hub
版本控制   使用Git & git hub版本控制   使用Git & git hub
版本控制 使用Git & git hub維佋 唐
 
COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報Bachue Zhou
 
Git and Github basic with SourceTree
Git and Github basic with SourceTreeGit and Github basic with SourceTree
Git and Github basic with SourceTreeChu-Siang Lai
 
Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀Wen-Tien Chang
 
Git Essence Tutorial
Git Essence TutorialGit Essence Tutorial
Git Essence TutorialHo Kim
 
Git+使用教程
Git+使用教程Git+使用教程
Git+使用教程gemron
 
Learning to Use Git | WeiYuan
Learning to Use Git | WeiYuanLearning to Use Git | WeiYuan
Learning to Use Git | WeiYuanWei-Yuan Chang
 
Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰Will Huang
 
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹PingLun Liao
 
如何與全世界分享你的 Library
如何與全世界分享你的 Library如何與全世界分享你的 Library
如何與全世界分享你的 LibraryMu Chun Wang
 
FHIR Server 安裝與使用
FHIR Server 安裝與使用FHIR Server 安裝與使用
FHIR Server 安裝與使用Lorex L. Yang
 
Learn git
Learn gitLearn git
Learn git甘 李
 
不一樣的 Web Server coServ Part II
不一樣的 Web Server coServ Part II不一樣的 Web Server coServ Part II
不一樣的 Web Server coServ Part IIBen Lue
 

Ähnlich wie 像Hackers一样写博客-hustcalm (20)

Github简介及实用入门
Github简介及实用入门Github简介及实用入门
Github简介及实用入门
 
Git 使用介绍
Git 使用介绍Git 使用介绍
Git 使用介绍
 
前端也能變全端
前端也能變全端前端也能變全端
前端也能變全端
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
First meetingwithgit
First meetingwithgitFirst meetingwithgit
First meetingwithgit
 
版本控制 使用Git & git hub
版本控制   使用Git & git hub版本控制   使用Git & git hub
版本控制 使用Git & git hub
 
COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報
 
Git and Github basic with SourceTree
Git and Github basic with SourceTreeGit and Github basic with SourceTree
Git and Github basic with SourceTree
 
Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀
 
Git Essence Tutorial
Git Essence TutorialGit Essence Tutorial
Git Essence Tutorial
 
Git+使用教程
Git+使用教程Git+使用教程
Git+使用教程
 
Learning to Use Git | WeiYuan
Learning to Use Git | WeiYuanLearning to Use Git | WeiYuan
Learning to Use Git | WeiYuan
 
Docker Build
Docker BuildDocker Build
Docker Build
 
Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰
 
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹
 
如何與全世界分享你的 Library
如何與全世界分享你的 Library如何與全世界分享你的 Library
如何與全世界分享你的 Library
 
FHIR Server 安裝與使用
FHIR Server 安裝與使用FHIR Server 安裝與使用
FHIR Server 安裝與使用
 
Learn git
Learn gitLearn git
Learn git
 
Cocoa on Rails 4th
Cocoa on Rails 4thCocoa on Rails 4th
Cocoa on Rails 4th
 
不一樣的 Web Server coServ Part II
不一樣的 Web Server coServ Part II不一樣的 Web Server coServ Part II
不一樣的 Web Server coServ Part II
 

Mehr von Lihang Li

Something about SSE and beyond
Something about SSE and beyondSomething about SSE and beyond
Something about SSE and beyondLihang Li
 
Some experiences and lessons learnt from hunting a job
Some experiences and lessons learnt from hunting a jobSome experiences and lessons learnt from hunting a job
Some experiences and lessons learnt from hunting a jobLihang Li
 
Getting started with Linux and Python by Caffe
Getting started with Linux and Python by CaffeGetting started with Linux and Python by Caffe
Getting started with Linux and Python by CaffeLihang Li
 
Rtabmap investigation report-lihang
Rtabmap investigation report-lihangRtabmap investigation report-lihang
Rtabmap investigation report-lihangLihang Li
 
Rgbdslam and mapping_investigation_report-lihang
Rgbdslam and mapping_investigation_report-lihangRgbdslam and mapping_investigation_report-lihang
Rgbdslam and mapping_investigation_report-lihangLihang Li
 
DTAM: Dense Tracking and Mapping in Real-Time, Robot vision Group
DTAM: Dense Tracking and Mapping in Real-Time, Robot vision GroupDTAM: Dense Tracking and Mapping in Real-Time, Robot vision Group
DTAM: Dense Tracking and Mapping in Real-Time, Robot vision GroupLihang Li
 

Mehr von Lihang Li (6)

Something about SSE and beyond
Something about SSE and beyondSomething about SSE and beyond
Something about SSE and beyond
 
Some experiences and lessons learnt from hunting a job
Some experiences and lessons learnt from hunting a jobSome experiences and lessons learnt from hunting a job
Some experiences and lessons learnt from hunting a job
 
Getting started with Linux and Python by Caffe
Getting started with Linux and Python by CaffeGetting started with Linux and Python by Caffe
Getting started with Linux and Python by Caffe
 
Rtabmap investigation report-lihang
Rtabmap investigation report-lihangRtabmap investigation report-lihang
Rtabmap investigation report-lihang
 
Rgbdslam and mapping_investigation_report-lihang
Rgbdslam and mapping_investigation_report-lihangRgbdslam and mapping_investigation_report-lihang
Rgbdslam and mapping_investigation_report-lihang
 
DTAM: Dense Tracking and Mapping in Real-Time, Robot vision Group
DTAM: Dense Tracking and Mapping in Real-Time, Robot vision GroupDTAM: Dense Tracking and Mapping in Real-Time, Robot vision Group
DTAM: Dense Tracking and Mapping in Real-Time, Robot vision Group
 

像Hackers一样写博客-hustcalm

  • 2. 写 Blog 的三个阶段 ● ● ● 第一阶段,刚接触 Blog ,觉得很新鲜,试着选择一个免费 空间来写。(新浪博客, CSDN ,博客园) 第二阶段,发现免费空间限制太多,就自己购买域名和空 间,搭建独立博客。( Wordpress , VPS ) 第三阶段,觉得独立博客的管理太麻烦,最好在保留控制权 的前提下,让别人来管,自己只负责写文章。( Octopress, Github pages )
  • 3. Github Pages ● Free Hosting ● Page Generation with Themes ● Manual Pages and Jekyll ● github Pages 可以被认为是用户编写的、托管在 github 上的静态网页
  • 4. Jekyll ● Jekyll (发音 /'dʒiːk əl/ , " 杰克尔 " )是一个静态站点 生成器,它会根据网页源码生成静态文件。它提供了模 板、变量、插件等功能,所以实际上可以用来编写整个 网站。 ● ● 参考链接: 像黑客一样写博客— Jekyll 入门 http://www.soimort.org/posts/101/ ●
  • 5. Octopress ● ● A blogging framework built on top of Jekyll for hackers Octopress is a framework designed by Brandon Mathis for Jekyll, the blog aware static site generator powering Github Pages. To start blogging with Jekyll, you have to write your own HTML templates, CSS, Javascripts and set up your configuration. But with Octopress All of that is already taken care of. Simply clone or fork Octopress, install dependencies and the theme, and you’re set.
  • 6. Octopress 优点 ● 使用静态页面; ● 不使用数据库; ● 使用 markdown 标记语言编写文章; ● ● 可以与 git 紧密集成,方便地进行博客的版本管 理; 与 Github Pages 集成,不需要单独的 web hosting ●
  • 7. Octopress 缺点 ● ● 生成的是静态网页,添加动态功能必须使用外 部服务,比如评论功能就只能用 disqus 。 不适合大型网站,因为没有用到数据库,每运 行一次都必须遍历全部的文本文件,网站越 大,生成时间越长
  • 8. Am I qualified? ● 使用 octopress 和 github 来管理 blog ,需要: ● 懂一点点 ruby(jekyll) ● 使用 github ● 基本的 git 命令 ● 基本的 Markdown 使用 ● 基本的 Web 前端知识
  • 10. Ruby ● 使用 rbenv 或者 rvm (推荐使用 rbenv ) ● https://github.com/sstephenson/rbenv ● https://github.com/sstephenson/ruby-build ● ● sudo apt-get install build-essential git-core zlib1g-dev libssl-dev libreadline-dev rbenv install 1.9.3-p194
  • 11. Octopress ● git clone git://github.com/imathis/octopress.git octopress ● cd octopress ● rbenv version ● gem install bundler # 安装 ruby 的 bundler # 检查 ruby 的版本是否 >=1.9.2 rbenv rehash command # If you use rbenv, rehash to be able to run the bundle ● bundle install # 安装依赖的组件 ● rake install # 安装默认的 Octopress 主题 ● ● ● Refer to: ● http://octopress.org/docs/setup/
  • 12. Github ● 在 github 上创建一个仓库,仓库格式 yourname.github.io ● 例如你的 GitHub 帐号是 geekboygo 就将 Repository 命名为 geekboygo.github.io , 完成后会得到一组 GitHub Pages URL http://yourname.github.io/ ● Refer to: https://help.github.com/articles/creating-pa ges-with-the-automatic-generator
  • 13. Bring It Together ● `rake setup_github_pages` 填写 git@github.com :geekboygo/geekboygo.github.io.git ● `rake generate` ● `rake deploy` ● 等待几分钟后, github 上会收到一封 信:“ [geekboygo.github.io] Page build successful” ,第 一次发布后等比较久,之后每次都会直接更新
  • 14. master 和 source 分支 ● ● Octopress 会把代码放在 source 目录下,把生成的 网站放在 _deploy 目录下。并自动将 _deploy 目录 作为 github page 的 master 分支,将包含 source 在内的部分作为 github page 的 source 分支 将 source 加入 git `git add .` `git commit -m 'initial source commit'` `git push origin source`
  • 15. 更新 Octopress ● ● ● ● git pull octopress master Octopress # Get the latest bundle install updated # Keep gems rake update_source template's source # update the rake update_style template's style # update the
  • 16. 发表文章并部署 ● rake new_post[" 新文章名称 "] ● rake preview ● rake generate ● rake deploy ● ● rake gen_deploy
  • 17. 绑定域名 ● 申请个人域名 (GoDaddy, name.com) ● ● cd source ● touch CNAME ● Echo “your_domainname” > CNAME ● ● In order to serve the Pages, your DNS needs to point at our server. If you are serving a top-level domain like example.com, you should have an A record pointing to 204.232.175.78. If you are using a subdomain like www.example.com, you should have a CNAME record pointing to [your-username].github.io
  • 19. 参考链接 - git & github ● ● git- 简易指南( http://rogerdudler.github.io/git-guide/index.zh.html) 如何高效利用 GitHub ( http://www.yangzhiping.com/tech/github.html) ● Github Pages 极简教程( http://yanping.me/cn/blog/2012/03/18/github-pages-st ep-by-step/ ) ●
  • 20. 参考链接 - Jekyll ● 像黑客一样写博客—— Jekyll 入门( http://www.soimort.org/posts/101/) ● 搭建一个免费的,无限流量的 Blog----github Pages 和 Jekyll 入门( http://www.ruanyifeng.com/blog/2012/08/blogging_with_jekyll.html) ● ● Jekyll 建站之旅( http://calefy.org/2012/03/03/my-process-of-building-jekyll-blog.html) 利用 Jekyll 搭建个人博客( http://www.mceiba.com/develop/jekyll-introduction.html)
  • 21. 参考链接 - Octopress ● 像 hackers 一样写博客( http://clark1231.iteye.com/blog/1506553) ● Blog = GitHub + Octopress ( http://mrzhang.me/blog/blog-equals-github-plusoctopress.html ) ● 使用 Octopress + Github 管理 blog ( http://ishalou.com/blog/2012/10/15/how-to-use-o ctopress/ ) ●
  • 22. 参考链接 - Markdown ● ● ● Markdown 写作浅谈( http://www.yangzhiping.com/tech/r-markdown-knitr.html ) Markdown 写作进阶: Pandoc 入门浅谈( http://www.yangzhiping.com/tech/pandoc.html ) 理想的写作环境: Git+Github+Markdown+Jekyll ( http://www.yangzhiping.com/tech/writing-space.html ) ● 献给写作者的 Markdown 新手指南( http://jianshu.io/p/q81RER) ● 黑魔法利器 pandoc ( http://yanping.me/cn/blog/2012/03/13/pandoc/ ) ● Markdown : Syntax ( http://markdown.tw/) ● R 语言忍者秘笈( https://github.com/yihui/r-ninja )
  • 23. Octopress 进阶 ● 为已经存在的 github Octopress 配置本地环境( http://www.360doc.com/content/12/0216/16/10167 83_187128091.shtml ) ● 服务器端 Octopress 搭建及移动方案( http://lucifr.com/2011/12/21/octopress-on-server-a nd-portable-scheme/ ) ● Use Jenkins to Auto Build Jekyll and Octopress ( http://b.imf.cc/blog/2013/01/01/use-jenkins-to-auto-b uild-jekyll-and-octopress/ )