Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Creating a GitHub Pages demo

Christine Wang edited this page Apr 30, 2016 · 1 revision

Wait but why?

Deploying your changes to GitHub Pages gives you a publicly accessible place to demonstrate your changes before they actually go to the website.

Ok, but why it so much more complicated for ME to create a GitHub Pages demo?

Unfortunately, GitHub pages doesn't support plugins, and we have a plugin to obfuscate email addresses. Attempting to push to origin/gh-pages directly from the master branch on your machine will give you a build error. So we need to generate all the static files first and push only those to your gh-pages branch.

Prerequisites

Before you try to create a demo in GitHub Pages, make sure you have the following:

  1. A working dev environment (should be the case after completing the Getting started guide)

Steps

  1. Create a new branch off master called generate-site in your website/ repository: git checkout -b generate-site
  2. Create a Rakefile by copying this file. Make sure to change the ORIGIN_REPO variable to your GitHub repo's URL. Add the Rakefile to your website/ directory, at the same level as the README.
  3. Add this robots.txt to the website/ directory at the same level as the README. This prevents your test site from being indexed by Google.
  4. Commit these changes to the generate-site branch.
  5. Run rake build_gh_pages from the command line within the website/ directory. This updates the website files in your generate-site branch, builds the static files, and copies the static files into a different directory called compile_site/. It also pushes the changes to your GitHub repo's gh-pages branch.