Test GitHub Pages for broken links


Wouldn’t it be nice to run a test that checks for broken links for your site hosted by GitHub Pages?

With Travis CI, you can certainly do that!

First, login to Travis and turn on the switch for your GitHub Pages repository.

Then add the html-proofer gem to your Gemfile:

echo "gem 'html-proofer'" >> Gemfile

Create your Travis configuration:

touch .travis.yml

And add the following:

language: ruby
rvm:
  - 2.2
cache: bundler
env:
  global:
    # speeds up installation of html-proofer
    - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
script:
  # replace `.` with the directory path of your site
  - bundle exec htmlproofer .

Finally, commit and push your changes to trigger the build on Travis.

If you have a Jekyll site, then I recommend checking out the docs on continuous integration. Feel free to use my personal site as a reference.

Also, Travis has a guide on building a ruby project.



Please support this site and join our Discord!