Migrated to Jekyll

You may have already noticed the blog is active again because of me accidentally leaving the Welcome to Jekyll! entry on the website.That entry was added when I created a new Jekyll repository and wrote a long Ruby script with lots of regexes and invocations of curl and Nokogiri to convert from the WordPress-exported XML to the Jekyll structure.I’m happy to say that the website is now fully converted to Jekyll and it will help me avoid the whole problem of WordPress security updates.

So why did I want to migrate to Jekyll in the first place? Because ever since I have been assimilated by Orgmode and immersed in Emacs, I wanted to write in Emacs and no longer wanted to do the long “edit-publish-refresh” cycle of using the WordPress admin, especially because I would write in Markdown or Org and then convert to HTML and upload the generated HTML to WordPress. Every time I had to edit the post after publishing, I would have to then edit HTML.

So Jekyll seemed like the best option because it allows me to choose the format that I write in. So I wrote a small plugin to render AsciiDoc, my new syntax of choice which I used to rewrite A Byte of Python:

#encoding: utf-8
# http://jekyllrb.com/docs/plugins/#converters
module Jekyll

  class AsciidocConverter < Converter
    safe true

    def setup
      # http://asciidoctor.org/rdoc/Asciidoctor.html
      require 'asciidoctor'
    rescue LoadError
      STDERR.puts "Cannot load asciidoctor gem"
      raise FatalException.new("Missing dependency: asciidoctor")

    def matches(ext)
      ext =~ /^\.asciidoc$/i

    def output_ext(ext)

    def convert(content)
        {:attributes => {"source-highlighter" => "pygments"}}).render

So, voila, I wrote this blog post in AsciiDoc and Jekyll.

Now, all I need for hosting this website is just nginx http server and some rewrite rules (for backwards compatibility of URLs), and I’m done. No other software required.

With this setup, hopefully, I should be able to write often again. Hope.

Published by swaroop