Skip to content

collectBrokenLinks

Finds every internal link across the built documentation pages that does not resolve.

External and non-HTTP links are ignored. Each internal link must resolve to an existing page, and each #fragment must resolve to an existing element id on the target page.

Import:

import { collectBrokenLinks } from '@mnaoumov/typescript-dev-toolkit/docs-site/link-check';

Signature:

function collectBrokenLinks(pages: DocumentationPage[], fileSystem: LinkCheckFileSystem, siteBaseUrl: string): BrokenLink[]

Parameters:

Parameter Type Description
pages DocumentationPage[] The built documentation pages to validate.
fileSystem LinkCheckFileSystem Injected access to the build output.
siteBaseUrl string The absolute base URL the site is served from (with a trailing slash).

Returns: BrokenLink[] — Every broken internal link, in page-then-document order.