Server side includes alternative

user3406225 picture user3406225 · Mar 11, 2014 · Viewed 8.7k times · Source

I have a static site hosted on GitHub Pages which is starting to grow in size. Normally I would use server side includes (<?php include('path to file'); ?>) to bring in header, footer and any navigation files. However php doesn't run on GitHub Pages.

Is HTML5 embedding which adopts a sort of iFrame technique my only option here?

I have seen threads such as this, this, this, this however they do not seem to apply for GitHub pages.

Not really ideal.

Thanks.

Answer

nicksuch picture nicksuch · Mar 12, 2014

Jekyll is a common solution for this. It is a static site generator that allows you to use Liquid templates, and is made to run on GitHub's servers.

A great example of the {% include %} feature can be seen on the documentation pages from Twitter Bootstrap, which make use of includes for header.html and footer.html:

enter image description here