/
atom.xml
124 lines (82 loc) · 4.36 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Category: github | Wongyouth's Blog]]></title>
<link href="http://wongyouth.github.com/blog/categories/github/atom.xml" rel="self"/>
<link href="http://wongyouth.github.com/"/>
<updated>2012-06-19T10:18:14+08:00</updated>
<id>http://wongyouth.github.com/</id>
<author>
<name><![CDATA[Wongyouth]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[用octopress来写博客并发布到Github上]]></title>
<link href="http://wongyouth.github.com/blog/2012/04/21/install-octopress-to-write-blogs-and-deploy-on-github-dot-com/"/>
<updated>2012-04-21T20:54:00+08:00</updated>
<id>http://wongyouth.github.com/blog/2012/04/21/install-octopress-to-write-blogs-and-deploy-on-github-dot-com</id>
<content type="html"><![CDATA[<p>用过不少博客,MSN spaces,blogger.com,myspace, wordpress,搜狐,总是觉得少了点自由发挥的空间。直到现有有了<a href="http://octopress.org/">octopress</a>,就像我这个博客一样,这才是咱程序猿该有的!</p>
<ol>
<li>安装</li>
<li>配置</li>
<li>发布</li>
<li>写第一个博文</li>
</ol>
<h2>安装</h2>
<p>``` sh Install octopress</p>
<pre><code>git clone git://github.com/imathis/octopress.git octopress
cd octopress
bundler install
rake install
</code></pre>
<p>```</p>
<h2>配置</h2>
<p>你要先有个github.com的帐号,如果没有赶快注册吧。
注册好后新建一个软件仓库 <a href="https://github.com/new">https://github.com/new</a> ,注意仓库名称要以下这种格式哦<code>yourname.github.com</code>,这样代码发布后自动这个url就可以访问了。</p>
<p>``` sh</p>
<pre><code>rake setup_github_pages
</code></pre>
<p>```</p>
<p>这个命令主要做以下的操作</p>
<ol>
<li>问你github上的url。 我的是 git@github.com:wongyouth/wongyouth.github.com.git</li>
<li>将原始的<code>imathis/octopress</code>远端仓库<code>origin</code>名称改为<code>octopress</code></li>
<li>把你输入的url作为远端仓库名<code>origin</code></li>
<li>把当前目录从分支<code>master</code>切换到<code>source</code></li>
<li>把当前目录与<code>origin</code>的仓库关联,能默认push到github中</li>
<li>配置<code>_deploy</code>目录作为github仓库的<code>master</code>分支</li>
</ol>
<p>要做的就是把原始的blog代码放在<code>source</code>分支中,当要发布时会自动生成发布代码到<code>_deploy</code>目录下以<code>master</code>分支更新到github上。github会以<code>master</code>中的代码作为blog的原始代码。</p>
<h2>发布</h2>
<p>``` sh Deploy blog</p>
<pre><code>rake generate
rake deploy
</code></pre>
<p>```</p>
<p>当你发布之后,你就可以到 <a href="http://yourname.github.com">http://yourname.github.com</a> 上看到你的博客了,是不是很酷呢。</p>
<h2>写第一个博文</h2>
<p>``` sh Create first post</p>
<pre><code>rake new_post['first post']
</code></pre>
<p>```</p>
<p>引号里面是博文的标题,这个命令会在<code>source/_posts</code>下面生成一个markdown为后缀的文件,我们要做的就是编辑这个文件的内容,然后</p>
<p>``` sh Start a local server for preview</p>
<pre><code>rake preview
</code></pre>
<p>```</p>
<p>会在本地启动sinatra服务,用浏览器打开 <a href="http://localhost:4000">http://localhost:4000</a> 就可以看到效果了。如果都没有问题就可以发布了。</p>
<p>有时候写了一半的博文想要先留为草稿放到服务器但是不发布这样情况。
我们可以在单独的这篇博文开头的yaml里面追加设置</p>
<pre><code>published: false
</code></pre>
<p>这样deploy的时候就不会发布了。</p>
<h2>其他</h2>
<p>你可以仔细查看以下三个文件,如果觉得有必要就按照自己的配置修改。</p>
<ol>
<li>_config.yml</li>
<li>config.rb</li>
<li>config.ru</li>
</ol>
<p>_config.yml中有关联其他一些社区的配置,比如github.com帐号,facebook帐号等。我认为比较有用的是<a href="http://disqus.com/">disqus</a>的评论帐号。到disqus注册一下,然后设置好<code>disqus_short_name</code>这样你的博客就有了评论功能了,而不是你一个人在唱独角戏了。</p>
]]></content>
</entry>
</feed>