Carson
Carson

Reputation: 2757

Have GitHub Pages render gh-pages branch rather than Jekyll content on master branch

I'm doing something like this here -- https://github.com/cpsievert/knitr-jekyll

However, it seems as though GitHub Pages is rendering the master branch instead of the gh-pages branch. Is there anyway to ensure GitHub Pages will prefer gh-pages over master?

Upvotes: 1

Views: 658

Answers (1)

Chris
Chris

Reputation: 136880

This isn't the result of GitHub Pages rendering the wrong branch, but a result of the URL that it renders it on. Your CSS link should be css/main.css, not /css/main.css.

The leading / causes the browser to request http://cpsievert.github.io/css/main.css while it should be looking for http://cpsievert.github.io/knitr-jekyll/css/main.css.

Edit: There is no way to specify the branch you wish to use with GitHub Pages. From the documentation:

User & Organization Pages live in a special repository dedicated to GitHub Pages files. You will need to name this repository with the account name, e.g. atmos/atmos.github.io.

  • You must use the username.github.io naming scheme.
  • Content from the master branch will be used to build and publish your GitHub Pages site.

Project Pages are similar to User and Organization Pages, with a few slight differences:

  • The gh-pages branch is used to build and publish Project Pages sites.

Upvotes: 3

Related Questions