James Ball

How Do You Do, Fellow Kids?

Octopress: My Thoughts After Switching From Wordpress

Octopress is a framework built on top of Jekyll. It’s a static site generator which means that it lacks advance feature which would normally require scripting and a back-end like Wordpress. If you want to know whether you should switch to Octopress or would like to know some tweaks, tips or adjustments then continue through this post.

Why To Migrate From Wordpress

  • Wordpress is a great blogging and CMS platform, but it just had too many features for my personal blog.
  • So far I have found Octopress easier to maintain than Wordpress. There is no need to maintain wp-super-cache which serves up static pages in the same ways as Octopress along with not needing to manage a local and external LAMP stack.
  • WordPress blogs are a common target for hackers and spammers. To avoid this you need to keep your version of Wordpress constantly up to date.
  • Octopress allow you to create pages using Markdown instead of or along with HTML. Markdown has a cleaner, simpler and more readable syntax.
  • Octopress uses Jekyll to build pages. All pages of the pages are static and no server-side processing involved. This means that any requested page can deliver immediately by the server to the user.
  • Sharing code is really easy if your blogging about programming. It’s really useful to share code with Octopress, I normally write my posts in SublimeText 2 which is the editor I use to write most of my code in. I can copy and paste code snippets into my Octopress post and keep all the formatting and highlighting. As well as working in a more customizable environment than Wordpress.

Features You Might Miss

  • You can’t edit online from anywhere. With Wordpress a mobile app was available so you did not need to be at your computer/laptop to publish new posts.
  • Yay Markdown. Shame there is no solid way to manipulate images except by hand. I have currently worked around this by using Picasa to host my images which will cache my images and resize my images.
  • Octopress does not feature drafts, previews or publishing. When you deploy your site, you deploy everything. And the publication date is the date it was started, not when it’s finished.
  • Although it’s nice not having to use the web interface it’s also a feature which I also miss being able to post from anywhere, on almost any device.
  • By default Octopress can take a long time when compiling posts, there is a workaround for this by using page isolation.
  • Octopress has less plugins and themes available than Wordpress, If you want more features you will need to wait for someone to write it or write it yourself.
  • By default Octopress does not have a comment system. Although there is the option to use an external service for page comments such as Disqus. But using a service like this means that the comments are not hosted on your service and you lack the flexibility of the Wordpress commenting system.

So Why Did I Switch?

Octopress is a great platform targeted at programmers who want to start blogging without having the hassle of customizing static page generators and caching on Wordpress. Personally I think that Octopress is ideal for my personal blog or a blog maintained by several developers which is where version control becomes essential. Although it is not practical for other user like a normal blogger who just wants to write content, a copy-editor or a business looking for more advance features such as LOREMIPSUM.

Tips, Tweaks & Adjustments

I have written a list of features and improvements which can be made on top of Octopress as well as some useful tips to build pages quicker and setting up a 404 page.

Faster Page Generation Using Isolation

If you have a lot post in source/_posts then it could take a long time to compile your posts every time you update you blog.

If you are only working on 1 post at a time then it would make sense to only compile that page, to do this use rake isolate[post_name].
This will isolate the post your are working on then automatically move all other posts to source/_stash.

When you are ready to publish your site, use rake integrate, which will move all posts from source/_stash and move them back to source/_posts.

Custom 404 Page

This is taken from a tutorial I have written in the past.

Open up config.ru from the root directory and update the sinatra not_found route to the following:

config.ru
1
2
3
not_found do
  send_sinatra_file('404')
end

This will redirect to http://yourdomain.com/404/ where the page is found, but we still need to create a page.

To do this use rake new_page[404]. This will create a new file named index.markdown in your /source/404 directory:

404/indexlink
1
2
3
4
5
6
7
8
9
10
---
layout: page
title: "404 Error"
comments: false
sharing: false
footer: false
---
Whoops, the page you’re looking for cannot be found.

Maybe you can find what you are looking for in the [archives](/blog/archives/).

View my 404 page here.

Related Posts

There is a related post plugin already included in Jekyll, to use it open up the _layouts/posts.html template and edit it

1
<a>CODE...</a>

To enable this function open up _config.yml and set lsi: true
The lsi option will use a statistical analysis to calculate which pages are most relevant.
Now you need to install GSL using Ruby Gems.

1
$ gem install gsl

After GSL is installed you can regenerated your blog.

Category List / Cloud Tree

Download the files from Github.
1. Save tag_cloud.rb to plugins/tag_cloud.rb
2. Save category_list.html to source/_includes/custom/asides/category_list.html
3. Append to default_asides in _config.yml:

1
default_asides: [custom/asides/category_list.html]

This plugin was created by tokkonopapa.

Escaping Special Character In Markdown

You can escape special characters in Markdown used in formatting using a \. For a list of characters you can escape take a look at this article from Daring Fireball.

Popular Posts

  1. Open up your Gemfile and add this: gem 'octopress-popular-posts'
  2. Install it using Bundler: bundle install
  3. Run the installation command through Bundler: bundle exec octopress-popular-posts install
    The popular posts asides will now generate whenever you run: rake generate
  4. Open up config.yml and add this line:
1
popular_posts_count: 3

Append to default_asides in _config.yml:

1
default_asides: [custom/asides/popular_posts.html]

Offloading Images to Picasa

At first I hosted all of my images using Octopress, then later switch to Picasa to host my images becuase of the following.

  • Images will be delivered from CDN (free)
  • Images will cache & resize on the fly.
  • You can create custom image sizes.
  • Optimize image by selecting image quality.

Remove Blog Prefix

When Octopress is first set up by default all of your posts, categories and archives will be placed in the /blog/ directory. It is possible to remove this by doing the following:

  • Replace all /blog occurrences with a / in _config.yml
  • Move source/blog/archives to source/
  • Edit source/_includes/custom/navigation.html, replace /blog/archives with /archives
  • Edit source/index.html and replace /blog/archives with /archives

Even More Plugins?

If you are still looking for more reasons to switch, then browse the Jekyll and Octopress plugin archives.