Fuzzy Tolerance Octopress Theme on Github

Ah, that’s better. This theme is still a work in progress, but you can get it here. It isn’t really a customizable theme per say (read: you probably don’t want to use it), but feel free to pilfer should you find anything useful.

It’s my usual minimal-style layout, with the header on the side (responsively moves to the top), and I got to fiddle about with an icon font for the first time, which was very nearly fun. Here are a couple more tips if you are considering moving to Octopress:

Get Rid of Paging/Previous/Next

One of the bummers with Jekyll/Octopress is that the default paging system you find on blogs - that previous/next post and paging stuff - means you have to essentially rsync your entire site every time you make a post. For me that’s ~600 files over a slow sftp connection.

Well…that’s bullshit. I took all of the paging links out. This blog isn’t a diary - one thing doesn’t naturally lead to the next. As a result, when I make a new post I only need to upload it and replace the main index.html, the archives index.html, the sitemap.xml and atom.xml. Much quicker.

Cleaning Up [code] Stuff from Legacy Wordpress Plugins

I had a lot of this crap floating around. I managed to automate cleaning most of this with my pal sed.

1
#!/bin/sh
sed -i 's/\[css\]/``` css/g' *.md;
sed -i 's/\[\/css\]/```/g' *.md;
sed -i 's/\[javascript\]/``` javascript/g' *.md;
sed -i 's/\[\/javascript\]/```/g' *.md;
sed -i 's/\[html\]/``` html/g' *.md;
sed -i 's/\[\/html\]/```/g' *.md;
sed -i 's/\[python\]/``` python/g' *.md;
sed -i 's/\[\/python\]/```/g' *.md;
sed -i 's/\[php\]/``` php/g' *.md;
sed -i 's/\[\/php\]/```/g' *.md;
sed -i 's/\[sql\]/``` sql/g' *.md;
sed -i 's/\[\/sql\]/```/g' *.md;
sed -i 's/\[sourcecode\]/```/g' *.md;
sed -i 's/\[\/sourcecode\]/```/g' *.md;
sed -i 's/\[crayon language="javascript"\]/``` javascript/g' *.md;
sed -i 's/\[\/crayon\]/```/g' *.md;
sed -i 's/\[bash\]/```/g' *.md;
sed -i 's/\[\/bash\]/```/g' *.md;

Eliminating a Bunch of 404’s

On my Wordpress blog I had posts going to /, like http://fuzzytolerance.info/post-1. Octopress wants to stick that in a /blog folder, and I tend to agree with it - I don’t want 500+ folders littering up root. But I don’t want all of the old links to 404, tossing my tiny bit of Google Juice into the wind. Here I had to dip deeper into mod_rewrite than I generally like, but it works.

1
RewriteEngine On
RewriteBase /

# do not do anything for already existing stuff
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]

# check if the files exist in /blog, if so go there
RewriteCond %{DOCUMENT_ROOT}/blog/%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}/blog/%{REQUEST_URI} -l [OR]
RewriteCond %{DOCUMENT_ROOT}/blog/%{REQUEST_URI} -d
RewriteRule .+ blog%{REQUEST_URI} [L]

Basically:

  1. Check to see if the file/directory exists. If it does, bugger off.
  2. If it didn’t exist - like maybe it’s a link to the old wordpress http://fuzzytolerance.info/post-1, check and see if it exists at http://fuzzytolerance.info/blog/post-1. If it does, go there and bugger off.
  3. If check 1 and 2 fail, it falls back to the default 404. And bugger off.