Moving from Blogger to Jekyll and GitHub Pages

I wanted something simple that would allow me to use markdown to create posts quickly. I had used Blogger for some of my posts earlier and I thought it would be good to move them to whatever I choose next. After some research I settled on Jekyll and GitHub Pages.

Setting up Jekyll

Not much here - installed Jekyll locally so I could easily preview the posts.

~$sudo apt-get install ruby-full build-essential zlib1g-dev
~$echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
~$echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
~$echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
~$source ~/.bashrc
~$gem install jekyll bundler

Creating new site

To create a new Jekyll site

~$jekyll new
~/$bundle exec jekyll serve

This will serve the website at http://localhost:4000

Adding to GitHub

Make sure that the repository on GitHub has Pages enabled - by default if you are creating a per user website then the name of the repository needs to be

~/$git init
~/$git remote add origin
~/$git add .
~/$git commit -m 'Initial GitHub pages site with Jekyll'
~/$git push origin master

I had to switch to using SSH with GitHub and I had never set it up before

~/$ ssh-keygen -t ed25519 -C "" 
cat ~/.ssh/

Add the contents of the public key in GitHub. Then add the key to SSH agent - make sure its running

~/$ eval "$(ssh-agent -s)"
Agent pid 13081
~/$ ssh-add ~/.ssh/id_ed25519 
~/$ git remote set-url origin

Importing posts from Blogger

First export all posts (Blooger calls it Backup) as XML. Follow official Jekyll documentation at Blogger Import

~/$ gem install jekyll-import

$ ruby -r rubygems -e  'require "jekyll-import";{ "source" => "/path/to/blog-MM-DD-YYYY.xml", "no-blogger-info" => false, # not to leave blogger-URL info (id and old URL) in the front matter "replace-internal-link" => false, # replace internal links using the post_url liquid tag. })'

Using custom domain name with GitHub pages

I wanted to use my domain name for this blog. I followed the documentation on GitHub Pages Under Settings and then Pages I put as custom domain. Once I did that GitHub Pages does an automatic check if the DNS records for this domain are properly set. If not, you are told what to do. I had to add a A record in my DNS server to point to GitHub Pages IPs

~/$ dig vivekrathod.cOM +noall +answer
vivekrathod.cOM.        0       IN      A
vivekrathod.cOM.        0       IN      A
vivekrathod.cOM.        0       IN      A
vivekrathod.cOM.        0       IN      A

As recommended, I also added CNAME record pointing to Once you do this, give it some time and re-check using the same page or use the dig command to see if the domain points to correct IPs. GitHub Pages also initiates generation of SSL/TLS certificate for enabling HTTPS. I chose to enforce HTTPS.

Enabling comments on posts

This one was interesting - Jekyll’s default theme minima apparently supports disqus for commenting. I wanted something less invasive so after some research I chose Getting it to work turned out to be a bit of a challange for me. The default minima theme is a gem based theme and it has it’s own _includes and _layouts directories so I was not sure where I would put the JavaScript for enabling comments using I could override the default or the post layout (default.html or post.html from _layouts) by copying from the minima directory

~/$ bundle info minima
  * minima (2.5.1)
        Summary: A beautiful, minimal theme for Jekyll.
        Path: /home/vivekrathod/gems/gems/minima-2.5.1
~/gems/gems/minima-2.5.1$ ls
LICENSE.txt  _includes  _layouts  _sass  assets
~/gems/gems/minima-2.5.1/_layouts$ ls
default.html  home.html  page.html  post.html

But then I would loose the ability to get updated layouts and/or includes when I update minima. Luckily, I noticed that minima supports disqus comments. I found this in the post.html

  {%- if site.disqus.shortname -%}
    {%- include disqus_comments.html -%}
  {%- endif -%}

So I added a fake disqus shortname in the _config.yml

#specifying a fake disqus shortname here and overriding _includes/disqus_comments.html in order to trick minima theme to load instead of disqus

And this way I could load the comments for all posts and still be able to update minima

Creating new posts

I found a Rakefile from the Jekyll Bootstrap project that simplifies creating a new posts. I removed some things in it I dont need, and it allows me to simply do this rake post title="A Title" [date="2012-02-09"] [tags=[tag1,tag2]] [category="category"]