A new year

Written on January 26, 2015

A new year began, and I’ve been working on a new home and a new design for The poor man’s math blog.

My old home page.

I started this blog six years ago; I admit it is not a great achievement as the frequency has always been from low to zero, but I put a substantial amount of effort and time in it, and occasionally has been quite rewarding. The problem is that these moments are exactly those in which I created some issues to our beloved macchinisti, the administrators of the student-run server that hosted my blog until yesterday. Thanks a lot to them for bearing with me!

Because of this, I decided to give them a break and my blog a more stable home, on GitHub. To avoid making this post completely useless, I will describe my set up, in case it is of interest to anybody.

GitHub offers free hosting for static pages at addresses like <username>.github.io, based on the content of a repository with the same name. Not only this, but it also treats some specific files in that repository in a special way, think of if “compiling” the repository to a static website. For reference, this is the repository for this site.

I acquired poormansmath.net some time ago, but it was not possible to use it in my previous home because I didn’t own the domain; luckily, this is true for GitHub. The first special file we will see is indeed CNAME, that tells GitHub the domain you want to use for the site.

Speaking about the compilation to static pages, GitHub uses Jekyll, I think triggered by the presence of a _config.yml file. Jekyll allows a limited template engine to run on your file, and a Markdown interpreter on your posts. The advantage over a completely static site is that a lot of boilerplate can be factored out in templates, and you can write posts in Markdown instead than in raw HTML, which is nice. I forked a project I liked, from Barry Clark, and built on that.

I changed some typeface, added semantic information for crawlers, sharing buttons, and a very simple lightbox-like image viewer. This all within GitHub’s compilation with Jekyll. I need to specify this, because Jekyll in general is quite versatile, and you can add new functionalities in Ruby. But, of course, running untrusted code on your server is complicated, so GitHub restrict the compilation to a safe subset of Jekyll.

But I added also a couple of features outside of Jekyll. The first is commenting: the way to add it to a static site is to use an external service, and I chose Disqus. The second is a custom script to append to each post a list of related posts.

The actual export of posts and comments was a bit painful. You can export them from Wordpress, and try to convert them in Markdown, but a lot of things had to be revised manually. This is where Emacs rocks: powerful regular expressions, even across files, the awesome multiple cursors feature, and keyboard macros, all of them made the job much faster.

See also

  1. WordPress upgrade
If you liked this post, please share it with your friends: