thoughts_on_rails

a blog about ruby on rails

Getting Started With Octopress

Welcome to my blog, thoughts_on_rails. I plan to put all sorts of useful stuff here, but we have to start somewhere. Where better than the blog itself? So, here’s my basic guide to setting up a blog just like this one.

This blog uses a really cool little gem called Octopress created by Brandon Mathis. It’s written in Ruby, based on Jekyll, and has absolutely nothing at all to do with Rails. I chose to use Octopress for this blog because of the git-based workflow and easy setup on Heroku. Here are the basic steps to get up and running, assuming you have a working install of Ruby 1.9.3.

  • Clone the project from Github
1
git clone git://github.com/imathis/octopress.git octopress
  • Install bundler (if you don’t already have it) and bundle
1
2
gem install bundler
bundle install
  • Install the default theme
1
rake install
  • Deploy the skeleton app to Heroku
1
2
3
4
5
6
7
gem install heroku
heroku create
rake generate
git add .
git commit -m 'initial commit'
git push heroku master
heroku apps:rename your-new-name --app original-app-name

This will create the app on Heroku and push up the skeleton you’ve generated. The last command is optional and will rename the app to something more memorable than the Heroku default.

  • Set up the basics in _config.yml
1
2
3
4
5
6
url: http://www.thoughtsonrails.com
title: thoughts_on_rails
subtitle: a blog about rails and what not
author: James Martin
simple_search: http://google.com/search
description: a blog about ruby, rails, and everything that comes with them
  • Make some changes to the templates

The templates are pretty self-explanatory, and can be found in the ‘source/layouts’ & ‘source/includes’ directories. Sass styles are located in the ‘sass’ directory.

  • Check out the results locally
1
rake preview

The blog will be hosted locally on port 4000.

  • Create a new post
1
rake new_post['hello world']

This will create a file called ‘YYYY-MM-DD-hello-world.markdown’ in ‘source/_posts’. This is where you will create the content of the post itself. The posts are (by default) written in Markdown format. In case your not familiar, here are the basics.

  • Commit everything and push it back up
1
2
3
git add .
git commit -m 'first post'
git push heroku master

And that’s all there is to it. You can read the docs to learn more. You can also check out the complete source for this blog on Github.

Comments