python4oceanographers

Turning ripples into waves

New website using hyde

I am building a new website with Jekyll hyde, and this post consists of some notes for my future self.

(The website source is hosted on GitHub here, and the page is rendered as gh-pages here.)

Hyde is a python alternative for ruby's Jekyll. The project seems to be outdated (no python 3 version, several non-attended PRs/Issues) and there is no direct integration with gh-pages like Jekyll. However, because it is written entirely in python, I could easily hack into it and modify existing plugins. The code I modified was Jake Vanderplas' IPython notebook plugin. My modification implements the latest IPython v4 notebook format.

(I am using v4 notebooks format for my lecture to take advantage of to the wonderful live slides feature!)

Here is the recipe for the site. First a site venv:

mkvirtualenv --python=/usr/bin/python2.7 hyde

Then install hyde, ghp-import and ipython (for the latest development version of ipython follow this instructions.

pip install hyde

pip install ghp-import

pip install ipython[all]

The repository is divided into a notebook folder, with the lecture slides, and a website folder, with the webpage source code.

I had to modify the publish directive in the Makefile as follows:

BASEDIR=$(CURDIR)
OUTPUTDIR=$(BASEDIR)/deploy_production

publish:
    hyde gen -c production.yaml
    ghp-import $(OUTPUTDIR)
    git push origin gh-pages

Now I can generate, serve and publish the site with

make gen
make serve
make publish

That's it! Here is the new website:

http://ocefpaf.github.io/python4oceanographers_intro_course

In [2]:
HTML(html)
Out[2]:

This post was written as an IPython notebook. It is available for download or as a static html.

Creative Commons License
python4oceanographers by Filipe Fernandes is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Based on a work at https://ocefpaf.github.io/.

Comments