GitHub+Octopressでブログ構築
GitHub+Octopressでブログを構築したときのメモ。
今回はGithub PagesのUser& Organization Pagesにブログを設置する。
あらかじめアカウント名.github.com
という名前のレポジトリを生成しておく。
サイトのURLはhttp://アカウント名.github.com/
になる。
Ruby 1.9.3
が必要。
$ git clone https://github.com/imathis/octopress.git atijust.github.com $ cd atijust.github.com $ rbenv global 1.9.3-p194 $ gem install bundler $ rbenv rehash $ bundle install $ rake install $ rake setup_github_pages Enter the read/write url for your repository: git@github.com:atijust/atijust.github.com.git $ rake generate $ rake deploy
rake generate
で_deploy
以下にサイトに公開されるファイルが生成されるようだ。
rake deploy
で_deploy
がmasterブランチにpushされ、
http://atijust.github.com/から参照できるようになる。
設定ファイルやポストはsourceブランチで管理するようなので別途pushしておく。
$ git add . $ git commit -m '最初のコミット' $ git push -u origin source
設定は_config.yml
で行う。
url: http://atijust.github.com title: GitHubでブログのテスト subtitle: Octopressでおためしブログ author: atijust simple_search: http://google.com/search description:
ポストを作成するコマンドが用意されている。
$ rake new_post['octopress-install'] $ vi source/_posts/2013-03-03-octopress-install.markdown
画像ファイルはsource/images
に月毎にディレクトリを作成して設置することにした。
rake generate
で_deploy
以下にコピーされるので絶対パスで指定。
書き終わったら生成&デプロイ。
$ rake generate $ rake deploy
ローカルでプレビューもできる。
$ rake preview