Hacking Off

20% Time All the Time

Jekyll (Octopress) in a Subdirectory: Removing Redundant /blog Path to Archives and Categories

When Octopress lives in /blog, the extra blog subdirectory attached to categories and archives results in a redundant “/blog/blog/resource” path. Here’s how to fix that.

_config.yml
1
2
3
# category_dir: blog/categories # Responsible for redundant path.
# Change to:
category_dir: categories
source/_includes/custom/navigation.html
1
2
3
<li><a href="/blog/archives">Archives</a></li>
<!-- change to -->
<li><a href="/archives">Archives</a></li>

Finally, in the source directory, move the /blogs/archive/index.html file to /archive/index.html. (Erase the empty blog folder, too.)

Also, in case you want the massive site-name header to link to your domain root, instead of the blog here’s what you do.

source/_includes/custom/header.html
1
2
3
  <h1><a href="/">Hacking Off</a></h1>
<!-- change to -->
  <h1><a href="http://yourdomain/">Hacking Off</a></h1>

I don’t especially like this fix. It seems like something that should be handled with the “root” entry in config.yml. Changing “root: /blog” to “root: /” in config.yml doesn’t do the trick, and only serves to screw up the deployment.