Seven Story Rabbit Hole

Building agents and MCP Apps, one rabbit hole at a time

   Steampunk rabbit peeking out of a hole

Octopress Setup Part II

Showing my tweets on my blog

What’s a blog without a few tweets to spice it up?

Here’s my first attempt, which didn’t work. I modified my _config.yml file to have:

1
twitter_user: tleydn

After some desperate googling, I came across this blog post which seems to suggest that twitter support has been remoted from Octopress, with instructions on how to embed a twitter widget.

Here’s a few tricks to make it looks slightly less butt-ugly:

  • In the twitter widget generator, choose the “dark” theme.
  • Modify the widget class to have dimensions width="300" height="350" so that it is slightly less distracting when viewing content.

Adding an “About” page

I followed the instructions on Theming & Customization, which added an About section on the top of the sidebar on the right side.

Enabling Disqus comments

This was trivial:

  • Go to Disqus and register a new site
  • Add the “shortname” to the _config.yml file

Let’s pimp this thing — Adding an image in the header

  • Open octopress/source/_includes/custom/header.html
  • Find an image graphic and save it into octopress/source/images (in my case, it was /images/rabbit_hole_graphic.png)
  • Add a new html table element, and in one cell add a link to the image with the appropriate size dimensions.

Example header.html file:

1
2
3
4
5
6
7
8
9
  <table><tr><td>
  <h1><a href="{{ root_url }}/">{{ site.title }}</a></h1>
  {% if site.subtitle %}
    <h2>{{ site.subtitle }}</h2>
  {% endif %}
  </td><td>  
  {% img left /images/rabbit_hole_graphic.png 295 105 'image' 'images' %}
  </td></tr>
  </table>

I’m not a hipster, it’s just that my HTML coding skillz are stuck at about 1995. If you are seething with the overwhelming urge to tell me how to do this in 2013 CSS style, go right ahead and add a comment.

Anyway, the end justifies the means:

images

Octopress Setup Part I

I’m writing this blog entry as I’m creating my blog. I have decided to use Octopress, and I’m initially going to host it on Github Pages.

Step 1: create a github pages repo

In my case, I made a new repo called tleyden/tleyden.github.io.

Step 2: push an index.html

Clone the repo

1
$ git clone git@github.com:tleyden/tleyden.github.io.git

Add some content

1
2
$ cd tleyden.github.io
$ echo "<h1>hello</h1>" > index.html

Commit and push

1
2
3
$ git add index.html
$ git commit -m "empty blog"
$ git push origin master

Step 3: see if it actually worked

Go to http://tleyden.github.io/ to see if it works.

It did not work. WTH!?

Oh wait, it says: It may take up to ten minutes until your page is available.

Patiently hit reload 5 times / minute, and 7 minutes later .. IT WORKS!

Step 4: get rvm (octopress dependency)

1
2
3
$ \curl -L https://get.rvm.io | bash
$ source /Users/traun/.rvm/scripts/rvm
$ rvm notes

Step 5: get ruby 1.9.3 (octopress dependency)

1
2
3
4
5
6
7
8
9
10
$ rvm install 1.9.3
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p448.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system......
Error running 'requirements_osx_brew_update_system ruby-1.9.3-p448',
please read /Users/traun/.rvm/log/1378534467_ruby-1.9.3-p448/update_system.log
Requirements installation failed with status: 1.

I managed to get past this error by following this stack overflow post. However, the second time I went through these instructions, I got this error which I haven’t figured out yet.

Let’s try this again ..

1
Installing required packages: gcc46, libyaml, libksba, openssl......................................................................................................

45 minutes later, it finally worked.

1
2
$ rvm use 1.9.3
$ rvm rubygems latest

Step 6: get octopress

Follow the Setup Ocotpress instructions

Step 7: recreate repo

So this is a little awkward, and looking back I wish I hadn’t pushed that index.html earlier, because it interferes with the github push in the next step.

  • Delete your entire github repository: username/username.github.io
  • Create a new empty github repository: username/username.github.io

Step 8: deploy to github pages

Follow the Deploy to Github pages instructions.

There is one step that is crucial if you don’t want to accidentally lose your blog content:

1
2
3
git add .
git commit -m 'your message'
git push origin source

After doing that, your github repo should have two branches:

  • Master: the “published blog” goes here, and will have a top-level index.html
  • Source: the entire octopress source tree, plus a “source” and “sass” directory. The “source” directory is where your blog markdown content will actually live.

Step 9: write a blog entry

Follow the New blog post instructions.

Step 10: re-deploy

From the last step in the Deploy to Github pages instructions, do the following:

1
2
$ rake generate
$ rake deploy

NOTE: if you get this error:

1
2
3
cd _deploy
rake aborted!
No such file or directory - _deploy

Then the fix is to git clone the repo into a subdirectory called _deploy (sibling dir of public), and then re-run rake deploy:

1
2
$ git clone git@github.com:tleyden/tleyden.github.io.git _deploy
$ rake deploy

Step 11: revel in it’s beauty

screenshot

Step 12: Oops, don’t forget to push the source changes!

Even though the blog content is deployed (eg, your master branch with your content has been pushed to github), the source is still sitting on your computer. If your hard drive crashes, you’ll lose your markdown, which is no fun.

Here’s how to push the latest changes of your source files up to github:

1
2
3
git add .
git commit -m 'I just added a new blog entry'
git push origin source