Skip to content

Ferrolink 0.2, a link checker for static sites

Catch broken links before they go live.Check the build your visitors will get.

Documentation sites and blogs are built into a folder of HTML pages, images and scripts, and every page points at others. Rename a page or reword a heading, and some of those pointers lead nowhere. Ferrolink reads the finished folder and checks every link, asset and anchor against the files that are really there, without starting a server or making network requests. For documentation sites, static site generators, and CI deployment checks.

  • 3 kindsof issue: a missing file, a missing anchor, a link outside the site’s path
  • Offlinelinks to other hosts are counted, never fetched
  • CLI, Node.js, Viteone native checker behind all three
  • Rust 1.96+Apache-2.0; the npm package runs on Node.js 20.19+ or 22.12+

A finished site is a folder of pages that point at each other.

Documentation and blogs are often built by a static site generator: a program that turns Markdown into a folder of HTML pages, images and scripts. A host such as GitHub Pages or Netlify then serves that folder as it is. Every page in it points at others: a link to the next chapter, an image, a stylesheet, a jump to a heading further down.

Rename a page, reword a heading or move the site under a new path, and some of those pointers lead nowhere. A visitor gets an error page, an empty frame where an image should be, or the top of a long page instead of the section they wanted. The Markdown sources cannot tell you all of this, because the generator decides the final file names and addresses. Ferrolink reads the finished folder and checks each reference against the files that are really there.

Links and assets
Every address a page points at: links, images and responsive images, scripts, stylesheets, video posters, embedded frames and the preview image a social network shows.
Anchors
The part after the #. It must name an element on the target page, so a link lands on the section it promises.
The site’s path
On a site served under a folder such as /docs/, a link that forgets the folder works on your laptop and fails online.
Deployment files
Ardo’s versions.json and the redirect rules in _redirects and vercel.json, whose destinations are links too.

Every element and attribute it reads

Three small mistakes. One failed check.

A missing anchor, a missing image and a link that forgets the site’s path. Switch between the same page before and after the fix.

Each issue names the file and line it was found on, what is wrong and the reference as it was written. In a pipeline, that is enough to stop the deployment: the command line exits with 1 when it finds issues, and the Vite plugin fails the build. The page below sits on a site served under /docs/, so a link to /guide/setup leaves it, however right it looks.

The page, as builtindex.html
  1. <!doctype html>
  2. <title>Example</title>
  3. <a href="/docs/guide/setup#installation">Install</a>
  4. <img src="/docs/assets/preview.svg" alt="Preview">
  5. <a href="/guide/setup">Guide</a>
  6. <a href="https://example.net/">External</a>
Three issues foundreport.issues

index.html

  • line 3 · missing anchor/docs/guide/setup#installation
  • line 4 · broken link/docs/assets/preview.svg
  • line 5 · outside base/guide/setup

Counted, from report.summary

  • two pages checked
  • three references inside the site
  • one external URL, not fetched

Real output of the ferrolink npm package 0.2.2, checked with siteUrl: "https://example.org/docs/". The build also holds guide/setup.html and assets/logo.svg.

Show the other files of the build
In the buildguide/setup.html
  1. <!doctype html>
  2. <title>Setup</title>
  3. <h1 id="install">Install</h1>
In the buildassets/logo.svg
  1. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6"/></svg>

Run the check on your own build

Checked the way your host will serve it.

A link to /guide can mean guide.html, a folder’s index.html or nothing at all. Ferrolink follows the rules that static hosts share.

GitHub Pages, Netlify, Cloudflare Pages and most static servers agree on how an address becomes a file. An address that ends in a slash serves the folder’s index.html. Any other address serves the exact file if there is one, then the same name with .html, then a folder’s index.html. Ferrolink resolves every reference by the same rules, so it finds what a visitor would find.

Names are compared exactly, as on those hosts, even when your own disk would let a wrong capital letter pass. Give Ferrolink the site’s public address, and links that spell out your own host, such as a canonical link, are checked like any other path. Here is one page with eight links, checked against a build of three files.

Eight links, five foundsiteUrl: https://example.org/docs/
  • /docs/guidefound
  • /docs/guide.htmlfound
  • /docs/blog/found
  • /docs/blogfound
  • https://example.org/docs/blog/found
  • /docs/Guidebroken link
  • /docs/guide/broken link
  • /guideoutside base

Real output of the ferrolink npm package 0.2.2. The build holds index.html, guide.html and blog/index.html, and every link stands on index.html.

How addresses map to files

Old versions stay online. Their links need rules.

Documentation keeps earlier versions next to the current one. Ferrolink can leave an archive alone, accept a version that lives elsewhere, and still check what your host is told to serve.

An archived version was correct when it shipped, and nobody will edit it again. Its links may point at pages that have moved on since. A check that fails on every old page teaches a team to stop reading the check, so Ferrolink offers two separate choices. exclude skips the links inside matching pages, while links into them still have their anchors checked. assumePresent accepts links to paths that are deployed separately, without looking for them in the build.

The files that steer a host count as well. A redirect to a page that no longer exists sends visitors to an error just like a broken link does. Switch between the three checks below: with both rules in place, one issue is left, the redirect in _redirects to /v2/api/, a page the build does not have.

The check, in Node.jscheck()
  1. const report = await check({
  2. root: "site",
  3. });
Three issues foundreport.issues

_redirects

  • line 3 · broken link/v2/api/

v1/index.html

  • line 3 · broken link/v1/api/

versions.json

  • line 11 · broken link/v0/

Real output of the ferrolink npm package 0.2.2, on a copy of the build below in a temporary folder. Version 2 is current, version 1 is an archive with an old link, and version 0 is listed in versions.json but deployed somewhere else.

Show the build’s files, versions.json and _redirects
The build5 files
  1. _redirects
  2. v1/index.html
  3. v2/guide/index.html
  4. v2/index.html
  5. versions.json
The version listversions.json
  1. {
  2. "current": "v2",
  3. "versions": [
  4. {
  5. "path": "/v2/"
  6. },
  7. {
  8. "path": "/v1/"
  9. },
  10. {
  11. "path": "/v0/"
  12. }
  13. ]
  14. }
The host’s redirects_redirects
  1. /latest/* /v2/:splat 301
  2. /start /v2/guide/ 301
  3. /api /v2/api/ 301

Every option for archived and separate versions

Audit search signals in the finished build.

Catch missing sitemap targets, conflicting canonicals, and sitemap URLs blocked by robots.txt or marked noindex.

Run ferrolink audit with the Rust CLI and the public URL of the build. Include the deployment path if the site lives under a folder such as /ardo/. JSON reports give CI a rule ID, file, and line for each finding.

Audit a build in CI

ferrolink audit build/client \
--site-url https://example.org/ardo/ \
--format json

✓ Supported · — Gap

Ferrolink and Search Quality Kit
CapabilityFerrolinkSearch Quality Kit
Build and navigation
Audit static builds offlineSupportedSupported
Native Rust audit binarySupportedGap
Check local link and asset targetsSupportedSupported
Check cross-page fragmentsSupportedGap
Check redirect and deployment filesSupportedGap
Check static reachability from entry pointsSupportedGap
Find pages with zero incoming linksGapSupported
Sitemaps and indexing
Validate XML sitemaps and indexesSupportedSupported
Discover sitemaps via robots.txtSupportedSupported
Detect missing static files listed in sitemapsSupportedGap
Validate sitemap lastmodSupportedSupported
Detect missing or multiple canonicalsSupportedSupported
Detect sitemap and canonical mismatchesSupportedSupported
Detect HTML noindex in sitemap entriesSupportedSupported
Detect noindex in HTTP headersGapSupported
Detect robots.txt blocks on sitemap URLsSupportedSupported
Validate robots.txt syntaxGapSupported
Page checks
Validate HTML hreflang codes and return linksSupportedSupported
Check titles and meta descriptionsSupportedSupported
Validate Open Graph metadataGapSupported
Validate embedded JSON-LD syntaxSupportedSupported
Check Schema.org and rich-result requirementsGapSupported
Find exact content duplicatesGapSupported
Flag HTML, accessibility, and performance issuesGapSupported
Check llms.txt and declarative WebMCPGapSupported
HTTP and CI
Crawl a live originGapSupported
Detect HTTP redirect chains and loopsGapSupported
Report JSON with stable rule IDsSupportedSupported
Write SARIF reportsGapSupported
Gate on new findings against a baselineGapSupported
Review and expire suppressionsGapSupported
Provide a ready-made GitHub ActionGapSupported

Ferrolink coverage describes the source tree. Audit CLI and comparison sources

Two regular expressions read every page.

Ferrolink needs three things from a page: the addresses it points at, the anchors it offers and its base address. It never builds the page the way a browser does.

A browser turns HTML into a tree of elements before it shows anything, and a full HTML parser does the same work. A link checker needs a small part of it: the attributes that hold addresses, every id, and the first <base>. Ferrolink finds the files of the build with Ferralk, a glob matcher and file walker, and reads the pages in parallel with Ferroni, a regex engine. One expression finds comments and start tags, a second splits the attributes of the tags that matter.

That choice was measured against three HTML tokenizers on the same pages. On one thread, the regular expressions read them fastest. On all cores the whole check also spends its time finding files and checking references, and the gap closes: html5gum finished slightly ahead. Ferroni stayed, because it is the engine the family builds, so every check Ferrolink runs also tests it.

Time for the same pages

Ferroni = 1×, the line through every row. A bar past it took longer, a shorter bar less time.

The full comparison also covers broken markup, how the patterns were tuned and three fixes to Ferroni that came out of it. Every table, its method and its limits

Show the figures as a table
TaskScannerTimeRelative
Read every page, one threadFerroni50.6 ms1×
Read every page, one threadhtml5gum61.1 ms1.21×
Read every page, one threadlol_html73.3 ms1.45×
Read every page, one threadhtml5ever129 ms2.55×
The whole check, all coresFerroni24.8 ms1×
The whole check, all coreshtml5gum23.7 ms0.96×
The whole check, all coreslol_html30.1 ms1.21×
The whole check, all coreshtml5ever35.4 ms1.43×

The price is known and small for generated pages. On markup with an unclosed quote, the expressions pick up at the next tag where a browser would not, and they decode only the character references that occur in addresses. On both builds of the Ardo documentation that were measured, every scanner reported the same issues.

A build check, not a crawler.

Ferrolink is a link checker for static sites. It checks page links, asset references and anchors in static HTML builds, without a server or network requests. It reads what your build wrote and leaves the internet alone: links to other hosts are counted, never fetched.

On the command line
cargo install --locked ferrolink, then ferrolink check dist after any static site generator. JSON output is there for CI annotations.
In Node.js
npm install --save-dev ferrolink brings a prebuilt native binary for macOS, Linux and Windows, without a Rust toolchain. It needs Node.js 20.19+ or 22.12+.
In a Vite build
The plugin checks the finished client output once the build is complete and fails the build when it finds issues, or only warns if you ask.
In Ardo
Ardo, a documentation framework for React, runs its link check on Ferrolink.
Not included
Fetching external addresses to see whether they are online, running a page’s JavaScript, or validating HTML against the full standard.
License
Apache-2.0, for the command line, the library and the npm package.

The JavaScript API and the Vite plugin are the supported contract; the Rust library serves the command line and the npm package and can change in any minor release. This website is checked by Ferrolink on every build.

The stability policy

HTML connects pages through links and anchors. Ferrolink checks those references against the finished build using browser-style URL resolution and static-host file routing, including deployment paths and redirect destinations. It is one of the Ferramenta engines, made by Sebastian Software in Mainz, Germany.

Check the build before it goes live.

Add the Vite plugin to stop a broken build, or run the command line after any static site generator. Both read the folder your build already wrote.