Thanks to github , we have another choice to setup a blog beyond the popluar wordpress, github pages + octopress (based on jekyll, simply we can say : octopress is jekyll + themes).
Using octopress we can setup a blog very easy , the most import is that the blog is host at github:
- it is free!
- version control !
- without bandwith limit !
- without storage space limit!
- keep as long as you wish !
Let’s go …
Step1: setup your project on github.
first , you need a github account , if you do not have one , please apply one on github
second ,you need create a new repository with your name , assume your github account name is yourname , you need create your project with the name yourname.github.io or yourname.github.com .
Step2: Setup Octopress
assume you are working on uinx or linux, you alredy have git installed.
then , install ruby with rvm or install ruby with Rbenv , use rvm for example :
run the following command from terminal to get rvm:
1
|
|
install ruby 1.9.3 or later 1:
1 2 3 |
|
get octopress from github:
1 2 3 |
|
install dependencies:
1 2 |
|
install the default theme:
1
|
|
if you met some error when using rake install
, please try bundle exec rake install
2 .
Step3: deploy to github pages
1
|
|
this command will do a couple things for you:
- Ask you for your github pages repository url.
- Rename the remote pointing to imathis/octopress from ‘origin’ to ‘octopress’
- Add your Github Pages repository as the default origin remote.
- Switch the active branch from master to source.
- Configure your blog’s url according to your repository.
- Set up a master branch for your project in the _deploy directory, ready for deployment.
Next run:
1 2 |
|
this will generate the content of your blog under _deploy directory and push it to master(gh-pages) branch , a few minites later, you can view your blog at yourname.github.io(com)
Step4: Configure Octopress
open _config.yml, change the config as you like:
1 2 3 4 5 |
|
Step5: Blogging
1
|
|
then, it will generate a file source/_post/YYYY-MM-DD-XXXX.markdown , this is the blog source , you can edit it with markdown , if you havn’t familiar with markdown , refer markdown wiki or markdown in Chinese
Step6: Generate & Preview
after finish one post , you can preview it:
1 2 3 |
|
open browser http://localhost:4000 you can see your blog.
Do not forget two things :
- Commit sources of your blog to github , from your local source branch to source branch in github.
1 2 3 |
|
- Deploy your blog, this will generate all files under_deploy and commit it to github master(gh-pages) branch.
1
|
|
Finally , you will get a similar blog as current stevevallay.github.io
Octopress Plugin
the first octopress plugin i recommanded is backtick code block , it can help add line number and syntax hightlight, octopress default installed it under plugin directory. Simple you can use it as following:
Syntax
``` [language] [title] [url] [line text]
code snipt
```
Example
``` bash
$ sudo make me a sandwich
```
1
|
|
Disqus
Disqus
is a blog comment hosting service for websites and online communities that uses a networked platform.
Octopress already have support for Disqus, to add Disqus
comments to your Octopress:
- You need Sign up an account of
Disqus
if you do not have one. - Register your site to Disqus, input
Site URL
,Site Name
andSite ShortName
(remember this , it is used in step 3). - Modify the
_config.yml
under your octopress directory as following (add yourSite ShortName
and setdisqus_show_comment_count
as true).
1 2 3 |
|