This post explains how to check your blog’s appearance for GitHub Pages using Docker. Make sure if your site follows Jekyll directory structure.

Prerequisites

If your site is just a group of .md files, my previous post How to apply and customize themes on GitHub Pages might be your help.

Take advantage of the docker image

Actually, Jekyll publishes a special container for GitHub Pages tagged by pages, so this is the one for debugging your GitHub Pages. It’s better to create a serve script to DRY using docker run like this:

 #!/bin/bash

 docker run --rm -p 4000:4000 \
  -v "$PWD/docs:/srv/jekyll" \
  -it jekyll/jekyll:pages \
  jekyll serve --unpublished --future
  • --unpublished means you can see your drafts front mattered by published: false
  • --future means it renders future posts

To see more options, search in Jekyll’s documentation.

All Done! Enjoy your site building! ;)