Table of Contents

Check a statically generated website for broken links and images.

Overview

After generating a website statically, it is a good practice to check that there are no broken links or images, there are some popular command line tools for this, in this case I will be using htmlproofer.

HTMLProofer is a set of tests to validate your HTML output. These tests check if your image references are legitimate, if they have alt tags, if your internal links are working, and so on. It’s intended to be an all-in-one checker for your output.

Install

It can be installed directly with gem:

$ gem install html-proofer

Or using bundle:

Adding gem 'html-proofer' to the file Gemfile and then:

$ gem install html-proofer

Executing

To test for broken links, just specify the directory, for example using the common Jekyll output directory _site:


$ htmlproofer ./_site
0

References

Uruguay
Marcelo Canina
I'm Marcelo Canina, a developer from Uruguay. I build websites and web-based applications from the ground up and share what I learn here.