Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (35 sloc) 1.49 KB
layout title date excerpt categories
post
Test GitHub Pages for broken links
2017-01-31 21:43:00 -4000
Set up Travis CI for your site hosted by GitHub Pages.
travis github-pages html-proofer

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.