Skip to content

Set Up gh‐pages Branch

Tiffany Forkner edited this page Apr 2, 2025 · 4 revisions

Create the Branch

Create an orphaned branch in your repo to hold the source for the GitHub pages.

# Create a new branch to hold the jekyll code
git checkout --orphan gh-pages

# Remove the source files from git
git rm -rf .

# Check that there are no files to be committed
git status

# Create an empty commit
git commit --allow-empty -m "setup empty branch for jekyll code"

# Push the new branch to origin
git push --set-upstream origin gh-pages

# Set rebase strategy
git config pull.rebase true

Set Up Jekyll

Warning

Prerequisites Jekyll requires the following:

  • Ruby version 2.7.0 or higher
  • RubyGems
  • GCC and Make Install all of the prerequisites before beginning.

See the Jekyll docs for more information.

# install Jekyll and bundler gems
gem install jekyll bundler

# create the new site in the current directory
jekyll new .

# start the local server
bundle exec jekyll serve

Browse to http://localhost:4000 to view the site.

You don’t need _posts/ and about.markdown and can delete them.

Open _config.yml and update the site settings. You can remove the contact fields, if you don’t need them.

# Site settings
# These are used to personalize your new site. If you look in the HTML files, you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible in the templates via {{ site.myvariable }}.
title: Report Dashboard # the title of your site
email: [email protected] # OPTIONAL
description: >- # this means to ignore newlines until "baseurl:"
  Example repo to demonstrate how to create a reporting dashboard for tests
baseurl: "/publish-playwright" # your GitHub repo name
url: "https://fearlesssolutions.github.io" # your GitHub pages url
github_username: thetif # OPTIONAL

Note

The Gemfile that is generated when you use the Jekyll bundler includes instructions about commenting out gem jekyll and uncommenting gem "github-pages". This makes the process of deploying the site to GitHub Pages much simpler. However, you are restricted in the plugins you can use. This tutorial uses a custom plugin to generate pages. So leave gem "github-pages" commented out.


Clone this wiki locally