Jekyll and other gadgets to manage a static blog

Posted: May 25, 2015
Category: jekyll

This blog uses a few modules and widgets, which I will present here. I believe individual components can be reused anywhere, so I'm writing them down as references.

Jekyll

Jekyll is Github's static site generator. The principle is straightforward: you compile a set of HTML/Markdown files locally, and you push the build on a server. Static pages can then be rendered by Apache, nginx or another web server without further deployment configuration.

Blog posts are written in Markdown, and converted to HTML.

Jekyll supports many plugins, which give you other means to generate HTML contents, for example from a BibTex file (see jekyll-scholar below).

RSS and Atom

Since Jekyll uses Liquid templating, it becomes easy to generate RSS/Atom content. All you need is a skeleton and a content block which loops through your blog posts. This has been done here for RSS and here for Atom.

You can copy the files e.g. in blog/feed/, and Jekyll will do the rest.

I also generate an RSS feed which contains only posts in the debian category. This way, only selected posts appear on Debian Planet. To get it, simply filter your posts in an RSS file:

{% for post in site.categories.debian limit:10 %}
  <item>
    <title>{{ post.title | xml_escape }}</title>
    <description>{{ post.content | xml_escape }}</description>
    <pubDate>{{ post.date | date: "%a, %d %b %Y %H:%M:%S %z" }}</pubDate>
    <link>{{ site.url }}{{ post.url }}</link>
    <guid isPermaLink="true">{{ site.url }}{{ post.url }}</guid>
  </item>
{% endfor %}

jekyll-scholar

jekyll-scholar is an extension providing a way to display a list of academic publications. It's highly configurable to easily suit most needs.

Here's how I use it. I have a git submodule named bibliography in my Jekyll repository, which contains a BibTex file. This file is parsed by jekyll-scholar, the content is rendered for every item and fed to a biblio.html layout (this permits me to generate togglable links for the abstract and the bibtex).

The pdf files are stored in a dl/papers/ folder. They are named after their BibTex id, hence it is easy to generate links to them.

Disqus

That one is simple. Disqus is a proprietary platform, which can host comments posted by visitors. They take care of logging, and provide a platform for comments moderation. Integrating Disqus is only a matter of copy/pasting a bunch of HTML/Javascript lines.

Layout

You can find plenty of Jekyll themes out in the wild.

I personnally preferred to write my own one. It's quite easy if you use CSS frameworks like Twitter Bootstrap. Learning the grid layout is fast and permits to get a mobile-friendly site in minutes.

Font Awesome

Icons on the left menu come from Font Awesome.

Conclusion

This post will be updated to always reflect a recent configuration. I use it as a notebook if I want to rebuild a Jekyll site. Hope that helps!