GitHub pages subdirectory hassle

This blog is hosted on GitHub pages. It is automatically generated from Markdown source files by Jekyll every time a commit is pushed to the gh-pages branch of the GitHub repo corresponding to the blog.

I have a private repo called ‘blog’, and under normal circumstances its ‘project page’ (actually my blog) would appear at, say, http://myusername.github.io/blog.

GitHub’s Jekyll process seems to be clever enough to handle this and ensure that html links in the source code are rendered correctly as links relative to this base URL.

However, I use a custom domain http://eamonnbell.com which corresponds to http://eamonnbell.github.io (A record set with DNS provider, and CNAME file stored in GitHub repo per instructions). This leads to borked URL rendering when the blog at http://eamonnbell.com/blog is accessed. Symptoms include URLs with two forward slashes and missing CSS styling.

The solution is buried here in the Jekyll documentation and it works like a charm: http://jekyllrb.com/docs/github-pages/#project-page-url-structure.