DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Build Technical Blog Website from dsnote


GitBook

Login to GitBook, create a book. Clone to local, modify (all markdown files), push. That's it!

But now it's unstable. Some notes can't be converted. The build ofen fails.

Octopress

Install

Ref: Octopress Setup.

sudo apt-get update
curl -L https://get.rvm.io | bash -s stable --ruby
rvm install 2.2 
rvm rubygems latest

Then install nvm, here I use node.js v6.9.1.

cd ~/apps
git clone git://github.com/imathis/octopress.git octopress
cd octopress
gem install bundler
bundle install
rake install

Note1: Do NOT use ruby 2.1.1, it can't install bundler, while ruby 2.1.2 is OK.

Note2: Ruby 1.9.3 in pre-installed on Ubuntu 14.04. An "Permission denied" error occurs when gem install bundler. You have to rvm install 2.1.2 to build a non-root ruby environment to install bundler.

Note3: If bundle install runs slow or stucked (in common case it takes less than 5s for installing a component), cancel it with Ctrl-C and rerun this command.

Usage

Setup

First create a new repo named ".github.io" on GitHub, "leetschau.github.io" for example.

Then build the blog website framework: rake setup_github_pages. When asked for the repository URL, provide the SSH one for convenient.

Configuration

Modify _config.yml to customize blog's title, subtitle, author and blog descriptions.

Under "3rd Party Settings", set "github_user" as "".

Post new blog

Run the following command to create a new post, and edit post content:

rake new_post["Hello World"]
vi source/_posts/2014-08-18-hello-world.markdown

Preview blog website

Run the following command to generate new post and preview them:

rake generate
rake watch    // optional
rake preview

If it complains no javascript rumtime found, run nvm use 0.10, where version number "0.10" is determined by nvm list. Now preview with url "http://localhost:4000".

Deploy to Github

Run generate and deploy tasks:

rake generate

If it complains no javascript rumtime found, run nvm use 0.10.

rake deploy

You need provide username (without @gmail.com) and password of your github account.

If you use a new octopress, but deploy to an existing github blog, you'll encounter a push failure when rake deploy.

Go to $OCTOPRESS_HOME/_deploy and run:

git pull origin master
git add -A
git ci -m "merge conflict manually"

Run rake deploy again in $OCTOPRESS_HOME, your blogs should be synchronized to github.

There are many other Static site generators. Some based on Python such as Pelican looks lighter than Octopress.



Published

Jul 10, 2014

Last Updated

Jul 10, 2014

Category

Tech

Tags

  • blog 2
  • gitbook, octopress 1

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor