GitHub Pages

GitHub Pages are public web pages for users, organizations, and repositories, that are freely hosted on GitHub’s github.io domain or on a custom domain name of your choice. GitHub Pages are compatible with Bunto behind the scenes, so in addition to supporting regular HTML content, they’re also a great way to host your Bunto-powered website for free.

Never built a website with GitHub Pages before? See this marvelous guide by Jonathan McGlone to get you up and running. This guide will teach you what you need to know about Git, GitHub, and Bunto to create your very own website on GitHub Pages.

Project Page URL Structure

Sometimes it’s nice to preview your Bunto site before you push your gh-pages branch to GitHub. However, the subdirectory-like URL structure GitHub uses for Project Pages complicates the proper resolution of URLs. In order to assure your site builds properly, use site.github.url in your URL’s.


<!-- Useful for styles with static names... -->
<link href="{{ site.github.url }}/path/to/css.css" rel="stylesheet">
<!-- and for documents/pages whose URL's can change... -->
[{{ page.title }}]("{{ page.url | prepend: site.github.url }}")

This way you can preview your site locally from the site root on localhost, but when GitHub generates your pages from the gh-pages branch all the URLs will resolve properly.

Deploying Bunto to GitHub Pages

GitHub Pages work by looking at certain branches of repositories on GitHub. There are two basic types available: user/organization pages and project pages. The way to deploy these two types of sites are nearly identical, except for a few minor details.

Use the github-pages gem

Our friends at GitHub have provided the github-pages gem which is used to manage Bunto and its dependencies on GitHub Pages. Using it in your projects means that when you deploy your site to GitHub Pages, you will not be caught by unexpected differences between various versions of the gems. To use the currently-deployed version of the gem in your project, add the following to your Gemfile:

source 'https://rubygems.org'

require 'json'
require 'open-uri'
versions = JSON.parse(open('https://pages.github.com/versions.json').read)

gem 'github-pages', versions['github-pages']

This will ensure that when you run bundle install, you have the correct version of the github-pages gem.

If that fails, simplify it:

source 'https://rubygems.org'

gem 'github-pages'

And be sure to run bundle update often.

If you like to install pages-gem on Windows you can find instructions by Jens Willmer on how to install github-pages gem on Windows (x64).

Installing github-pages gem on Windows

While Windows is not officially supported, it is possible to install github-pages gem on Windows. Special instructions can be found on our Windows-specific docs page.

User and Organization Pages

User and organization pages live in a special GitHub repository dedicated to only the GitHub Pages files. This repository must be named after the account name. For example, @mojombo’s user page repository has the name mojombo.github.io.

Content from the master branch of your repository will be used to build and publish the GitHub Pages site, so make sure your Bunto site is stored there.

Custom domains do not affect repository names

GitHub Pages are initially configured to live under the username.github.io subdomain, which is why repositories must be named this way even if a custom domain is being used.

Project Pages

Unlike user and organization Pages, Project Pages are kept in the same repository as the project they are for, except that the website content is stored in a specially named gh-pages branch or in a docs folder on the master branch. The content will be rendered using Bunto, and the output will become available under a subpath of your user pages subdomain, such as username.github.io/project (unless a custom domain is specified).

The Bunto project repository itself is a perfect example of this branch structure—the master branch contains the actual software project for Bunto, and the Bunto website that you’re looking at right now is contained in the docs folder of the same repository.

Please refer to GitHub official documentation on user, organization and project pages to see more detailed examples.

Source Files Must be in the Root Directory

GitHub Pages overrides the “Site Source” configuration value, so if you locate your files anywhere other than the root directory, your site may not build correctly.

GitHub Pages Documentation, Help, and Support

For more information about what you can do with GitHub Pages, as well as for troubleshooting guides, you should check out GitHub’s Pages Help section. If all else fails, you should contact GitHub Support.