Skip to Content

Link Validation

Find broken links at build time.

After the build, this plugin checks the links on your prerendered pages, and a broken link fails the build:

In "/docs/getting-started": link "/docs/missing-page" not-found

Add the plugin:

press.config.tsx
import { linkValidationPlugin } from "@fumapress/astro/plugins/link-validation";

createPress(content).plugins(linkValidationPlugin());

It checks links in Fumadocs layouts and your content.

Full URLs are skipped by default. Use these options to skip more links, or to check full URLs too:

press.config.tsx
linkValidationPlugin({
  ignored(href) {
    return href.startsWith("/preview/");
  },
});

CI Reports

To annotate a pull request instead of parsing an error message, write the results to a file. "json" keeps the build passing, and "both" also fails it.

linkValidationPlugin({
  report: "json", 
});

An empty list means validation ran and found nothing. Change the file name with diagnosticsPath.

The file goes to your outDir, which is public on a static host. See Post-Build Plugins.

Options

Last updated on

On this page