Testing GitHub Pages with Docker
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
- Have a GitHub Pages site
- Your site follows the Jekyll directory structure.
- Docker environment
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 bypublished: false
--future
means it renders future posts
To see more options, search in Jekyll’s documentation.
All Done! Enjoy your site building! ;)