jagmoreira.github.io

My personal website built with Pelican using my own custom version of the pelican-hyde theme, originally by jvanz.

Why User instead of Project Pages

I like the simple, yet cool ring of <user>.github.io (even though I am now using a custom domain name 😄), so I decided to build my website as a GitHub User Pages. This means the live website code can only live in the master branch of the repo. I didn't want to put the source code into a separate repo so after some searching I decided to split the repo into 2 branches:

  • develop: Contains all pelican settings, posts/pages source files, and theme submodule. This is the repo's default branch and where I do all the work.
  • master: Contains the built website html and css code. All content here is derivative so I never work directly on this branch.

Using ghp-import to publish to GitHub Pages

I use the ghp-import package to easily publish to GitHub Pages any website updates. It pushes the output dir to the master branch. Note that, if the master branch already exists on your GitHub repo it will be destroyed:

$ pelican content -o output -s pelicanconf.py
$ ghp-import output

Then, just make sure to add the output folder to the .gitignore to prevent from accidentally commiting it to the develop branch.

The pelican-quickstart script will ask you once for all necessary parameters and then will create a gh-pages Invoke task that automates the process even more:

$ invoke gh-pages

This task will commit your new build the current date.

Development workflow

  1. Checkout develop branch: $ git checkout develop

  2. Write or update a post/page, or make any changes to the theme.

  3. Commit and push all changes on develop branch: $ git commit -am "..."; git push

  4. Re-build website and push output directory to master branch: $ invoke gh-pages