npm License: MIT

This is an 11ty plugin to check for broken external links after a build.

Currently it only checks external links, but I might add internal links at some point. (Feel free to send a PR.)

The plugin uses node-html-parser and url-status-code under the hood, and caches results using eleventy-fetch.


1. Install the plugin


npm i -D eleventy-plugin-broken-links


yarn add -D eleventy-plugin-broken-links

2. Add to .eleventy.js config

const brokenLinksPlugin = require('eleventy-plugin-broken-links`);

module.exports = (eleventyConfig) => {
  // ... the rest of your config

3. Set options

There are currently three keys to the optional option object passed with eleventyConfig.addPlugin():

option default accepted values description
broken "warn" "warn", "error" whether to warn or throw an error
redirect "warn" "warn", "error" same as above
cacheDuration "1d" any value accepted by eleventy-fetch set the duration of the cache

Here’s an example using all options, with the defaults:

const brokenLinksPlugin = require('eleventy-plugin-broken-links`);

module.exports = (eleventyConfig) => {
  // ... the rest of your config
  eleventyConfig.addPlugin(brokenLinksPlugin, {
    redirect: 'warn',
    broken: 'warn',
    cacheDuration: '1d'

NOTE: If either the broken or redirect options are set to error, your build will not be successful if there are broken/redirected links!


I don’t have a roadmap or plan with this plugin. It’s my first one, and I just needed the functionality, so wrote it rather quickly.

That said, feel free to do a PR or create an issue.


View Github