Skip to content

Excluding broken links

Max Hufnagel edited this page Jun 23, 2015 · 3 revisions

When you bind your book with e.g. bin/bookbinder bind local, you will get a report on the broken links that appear in your site. As of version 4 of the bookbindery gem, this will produce a non-zero exit code (which will usually break your CI build).

If the broken links are considered harmless, you can use the broken_link_exclusions key in your config.yml. The value of the broken_link_exclusions key must be a valid regular expression. Bookbinder ignores broken link errors for paths that match the regex.

Example 1: If you are using compass to produce IE compatibility hacks, you can add the following to the config.yml for your book:

broken_link_exclusions: iefix

The string 'iefix' is a regexp that will matches paths such as '../../../fonts/fontawesome-webfont.eot?#iefix&v=4.1.0'. Note that this regex is not very strict, and any links to paths or URLs that include the word 'iefix' will also not fail the link checker.

Example 2: If you are building PCF docs locally and do not have a local copy of the tracker-pcf repo, your build will fail. To ignore the tracker-pcf repo and iefix links, add the following to to your book's config.yml:

broken_link_exclusions: iefix|tracker-pcf

The string 'iefix|tracker-pcf' is a regexp that checks for any paths that contain iefix or tracker-pcf. This regex is not very strict.