Cristian Adam

From Blogger to Octopress

I decided to move away from Blogger blogging service to Octopress, which is “a framework designed for Jekyll, the static blogging engine powering Github Pages”.

I did the change because of two reasons:

  1. Notifications for comments. When Google introduced Google+ comments to Blogger I did the switch and for some unknown reason I am not receiving notification for comments on articles. I have spent some time trying to fix this problem without success.

  2. Syntax highlighting for code snippets. I was doing HTML exports from my text editor to include in blog posts, followed by a bit of HMTL fiddling, which is not always fun.

Moving away from Google implies having to host my own content. One can get free hosting at Github Pages, but I decided to have my own domain for a nicer online presence wink

Octopress requires a Ruby installation, which for a Windows hacker is a bit alien. I will explore the various options one has on Windows when it comes to Ruby in a future blog entry.

I have chosen Disqus to manage comments for the blog.

Octopress has some syntax highlighting support but is limited and one has too look after something better. I’ve picked CodeRay.

I’ve followed Jan Stevens’ Github Style code Highlighting for Octopress tutorial. For my Octopress version 2.0 instance running on Ruby 2.0 I had to do some changes:

diff -ur old/code_ray_block.rb new/code_ray_block.rb
--- old/code_ray_block.rb    Sun May 10 16:57:33 2015
+++ new/code_ray_block.rb    Sun Mar 15 11:11:13 2015
@@ -48,12 +48,11 @@
 
 require './plugins/pygments_code'
 require './plugins/raw'
+require 'coderay'
 
 module Jekyll
 
   class CodeRayBlock < Liquid::Block
-    include HighlightCode
-    include TemplateWrapper
     CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
     Caption = /(\S[\S\s]*)/
 
@@ -96,7 +95,7 @@
       else
         source += " #{CodeRay.scan(code, :text).div(:css => coderay_css, :line_numbers => line_numbers)} </figure>"
       end
-      source = safe_wrap(source)
+      source = TemplateWrapper::safe_wrap(source)
       source = context['pygments_prefix'] + source if context['pygments_prefix']
       source = source + context['pygments_suffix'] if context['pygments_suffix']
       source

There are tools which help to migrate content from Blogger to Octopress, but I decided to start fresh and too keep the old blog and comments. One cannot migrate Google+ comments.

Some numbers from my old blog: ~100 articles written in ~10 years which gathered ~120000 views.

Let’s see if this new blog will last ten years! relaxed

Comments