New site generator

1 minute read

I finally moved my pages from a static page generation system that I cobbled together with git, makefiles, pandoc, and css, to the Jekyll based pages you are reading right now.

My old site generation setup lacked several things, including:

  • mobile awareness
  • blog awareness with support for comments
  • support for social network sharing
  • support for RSS syndication

Of these, the most problematic was the lack of mobile awareness. What my old site had, was nice support for my habit of writing posts in markdown, with LaTeX math and Bibtex references, and compatibility with Github Pages.

After a little research I ended with

While the jekyll and theme combo is designed to work with Github Pages, using pandoc apparently breaks this. I decided this did not matter, as I have an alternative hosting mechanism.

Transferring the content from my old site to the new was pretty easy. However there were some minor snags that I was only able to resolve with “manual” intervention. Some highlights are

  1. Resolving resource links. The posts end up in a particular site location without relative links being preserved. The trick was to move any resources into a /assets/ subtree, and transform [text](resource) to

    [text]({{site.baseurl}}/assets/resource).

  2. Fixing syntax highlighting. The pandoc syntax highlighting in combination with my chosen jekyll theme did not look good (not highlighting and double spacing). I added --no-highlight to the flags: child in the pandoc: tree in _config.yml file. Now the code gets wrapped in <pre><code> tags. This allows the use of highlight.js for syntax highlighting. I selected my languages and

    1. downloaded the zip’ed package and unpacked it in my /assets/ directory, then

    2. added

      <link rel="stylesheet" href="/staal/assets/styles/default.css">
      <script src="/staal/assets/highlight.pack.js"></script>
      <script>hljs.initHighlightingOnLoad();</script> 

      to the <head> section of the theme’s _layouts/default.html file. This I downloaded from the github repo directly.

  3. Mathjax. I like having Mathjax render math in my pages. This did not work right out of the box. I had to

    • add --mathjax to aforementioned flags: child of the pandoc: tree in _config.yml, and

    • insert

      <script type="text/javascript"
         src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
      </script>

    in the theme’s _layouts/default.html file.

There might be more elegant ways of achieving the above, but it works so far.

A final thing that helped me was to download the _config.yml file from the test directory of the master branch here.

Tags:

Categories:

Updated: