Octopress and Github Pages

Published on:

I finally decided to establish my own blog. Sometimes there is something to write, so it is good to have a place where to put texts.

I knew about Octopress for some time, so to start actually using it, all that was needed is a good manual. Found this one: Tutorial: Create a Blog With Octopress and Host It in Github Pages

It explains what is Jekyll, what is Octopress, and provides step-by-step guide how to install and start using it.

No need to repeat here the whole manual, so I’ll just give a short excerpt (with my username and my site address).

Setting up the blog

1
2
3
4
5
git clone git://github.com/imathis/octopress.git denispeplin

bundle install

rake install

It is good to save work by commiting it back into repository, so I’ll do it, step by step

1
git add . ; git ci sass source -m 'rake install'

Next step is to provide some basic configuration

1
vim _config.yml

Will show it in the diff:

1
2
3
4
5
6
7
8
9
# config.yml
-url: http://yoursite.com
-title: My Octopress Blog
-subtitle: A blogging framework for hackers.
-author: Your Name
+url: http://denispeplin.github.io
+title: den's blog
+subtitle: Web Driven Development
+author: Denis Peplin

Checking in

1
git ci -m 'Change configuration' _config.yml

And blog setup is done!

The first article

1
rake new_post["Octopress and Github pages"]

Configuration line categories: of generated article is empty. I’ve decided to put [octopress,github pages] there and then commited the article.

1
git add . ; git ci -m 'rake new_post["Octopress and Github pages"]'

Then I’ve run

1
rake preview

… and got nothing. Actually, it was a blank page. And no error was displayed. Did not know what to do with that yet, moved to the next step.

Deploying to Github Pages and fixing the error

First, I created repository named denispeplin.github.io. Then run

1
2
3
4
5
rake setup_github_pages[git@github.com:denispeplin/denispeplin.github.io.git]

rake deploy

git push origin source

After executing these commands, my sources was on the source branch as expected, but on the master branch was only screen.css file, and so 404 error was displayed on http://denispeplin.github.io page.

After some research, I’ve found that it is also possible to run

1
rake generate

Finally, this command provided what I was searching for: a good error message.

1
2
3
ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
(<unknown>): could not find expected ':' while scanning a simple key at line 6 column 1 in /home/den/forks/denispeplin/source/_posts/2013-11-17-octopress-and-github-pages.markdown

It became obvious, that I forgot to put space between categories: keyword and actual categories list. So this is the fix:

1
2
-categories:[octopress,github pages]
+categories: [octopress,github pages]

Re-generate and re-deploy again

1
2
rake generate
rake deploy

And now the blog is up and running!

All is left to do it to fill the article with an actual content. First, I’ve put commands, that I used, to the source file, then commited it, and postponed the text for the next eveining (wnich is today at time of writting).

It is good to remember some Markdown to write nice looking article.

And for deploying and source pushing, there is a hint: use ssh-add to input ssh keyword only once.