Read Post

Jekyll Tag Generator Workaround on Github Pages

A few years back, I used Jekyll-Bootstrap to generate static pages. It was awesome because I could modify it to generate static pages for blog and company profile together. However, when I pushed my changes to Github Pages, pages aggregating post tags did not show up. It turned out that Github Pages does not execute tag_gen.rb under _plugins folder, as explained by Charlie Park.

Github Pages overrides safe configuration within _config.yml file as always true, preventing any plugin being executed. Charlie provided a nice and clean workaround, but I didn’t want to have two separate repositories for source and static pages. So, I came up with a much simpler workaround, which is copying tag folder, generated by Jekyll on local repository, out of _site folder by hand before pushing the latest changes to Github Pages. Based on this simple solution, I wrote a short bash script to do it in one go. The script is called jekyllrun.sh containing:

#!/bin/bash
rm -r tag
jekyll build
cp -r _site/tag .
jekyll serve

The script should be put at root directory. It deletes recursively tag folder before build, copy a new one from _site folder, and then starting Jekyll local service. That easy! I guess this workaround will stay, until one day the Github Pages’ policy is changed (or never).

← Prev Next →