computer

Octopress Gist vs Include-code

By Ganessh Kumar1 min read
  • github
  • octopress

I was using gist to share code snippets in this blog. Today I stumbled upon Pingdom, a tool to test the load time of that page, analyze it and find bottlenecks. I tested my blog and found that gist is taking approximately 300ms to load, which is bad. The average time taken to load my blog was 686ms and 300ms taken by gist is approximately 50% of the load time.

Files loaded from gist

  • My target file (from gist.github.com)
  • Gist CSS file (from gist-assets.github.com)

So I decided to stop using gist. To share code snippets, Octopress provides three other options: Backtick Code Blocks, Inline Code Blocks and Include Code. Of these three options, include code behaves very much like gist. You can put your code snippet into a file and give the filename as argument to include_code plugin. Further, When I had to share a ruby block in my blog, include_code seemed to be elegant way of doing it. Ruby block shared using other methods were executed by Octopress when generating the blog. Now the average load time of this blog is 375ms i.e. 45% faster than before.

Personally I prefer include_code if I am sharing a snippet or ruby code with paranthesis and blockcode if I am sharing one or two lines of code.

  • SEO in Octopress

    Learn how to optimize your Octopress blog for search engines by adding meta keywords and descriptions to your posts.

    • seo
    • blogging
    • octopress
  • Upgrading Google Analytics in Octopress

    Learn how to upgrade Google Analytics in Octopress to include Demographics and Interest reports with a simple one-line change.

    • google analytics
    • universal analytics

Keep reading

I write about full-stack development, developer tooling and the problems I run into building things. Here is everything else on the blog.