像Hackers一样写博客-hustcalm
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

像Hackers一样写博客-hustcalm

  • 742 views
Uploaded on

A detailed guide for getting started with Octopress for personal blogging, a static website generator which utilizes Github's Jekll and your blog will also be hosted on Github as a......

A detailed guide for getting started with Octopress for personal blogging, a static website generator which utilizes Github's Jekll and your blog will also be hosted on Github as a repository!

Happy blogging:-)

More in: Technology , Design
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
742
On Slideshare
742
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
2
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. 像 hackers 一样写博客 hustcalm@Open-CAS 2013-06-23
  • 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 前端知识
  • 9. Setup The Environment ● Ruby ● Octopress ● Github
  • 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
  • 18. Octopress 配置 ● _config.yml ● ● octopress 增加侧边栏( http://hustcalm.me/blog/categories/octopres s/ )
  • 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/ )
  • 24. 像 hackers 一样写博客 Q&A
  • 25. 像 hackers 一样写博客 Thank You!